Skip to content

Commit 0631d23

Browse files
committed
Use orEmpty()
1 parent 496a906 commit 0631d23

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Shrine/app/src/main/java/com/authentication/shrine/repository/AuthRepository.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ class AuthRepository @Inject constructor(
404404
apiResult.getSessionId()?.also {
405405
prefs[SESSION_ID] = it
406406
}
407-
prefs[USERNAME] = apiResult.body()?.username ?: ""
407+
prefs[USERNAME] = apiResult.body()?.username.orEmpty()
408408
prefs[DISPLAYNAME] = apiResult.body()?.displayName.orEmpty()
409409
}
410410
AuthResult.Success(Unit)
@@ -680,7 +680,7 @@ class AuthRepository @Inject constructor(
680680
apiResult.getSessionId()?.let { newSessionId ->
681681
dataStore.edit { prefs ->
682682
prefs[SESSION_ID] = newSessionId
683-
prefs[USERNAME] = apiResult.body()?.username ?: ""
683+
prefs[USERNAME] = apiResult.body()?.username.orEmpty()
684684
prefs[DISPLAYNAME] = apiResult.body()?.displayName.orEmpty()
685685
}
686686
return true

0 commit comments

Comments
 (0)