Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit ac21650

Browse files
committed
Manage responses with no avatar
1 parent d997c84 commit ac21650

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/users/GetRemoteUserAvatarOperation.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import java.net.URL
3838
class GetRemoteUserAvatarOperation(private val avatarDimension: Int) :
3939
RemoteOperation<RemoteAvatarData>() {
4040
override fun run(client: OwnCloudClient): RemoteOperationResult<RemoteAvatarData> {
41-
lateinit var inputStream: InputStream
41+
var inputStream: InputStream? = null
4242
lateinit var getMethod: GetMethod
4343

4444
lateinit var result: RemoteOperationResult<RemoteAvatarData>
@@ -71,7 +71,7 @@ class GetRemoteUserAvatarOperation(private val avatarDimension: Int) :
7171
Timber.d("Avatar size: Bytes received ${bytesArray.size} of $contentLength")
7272

7373
// find out etag
74-
val etag = WebdavUtils.getEtagFromResponse(getMethod);
74+
val etag = WebdavUtils.getEtagFromResponse(getMethod)
7575
if (etag.isEmpty()) {
7676
Timber.w("Could not read Etag from avatar")
7777
}
@@ -87,14 +87,14 @@ class GetRemoteUserAvatarOperation(private val avatarDimension: Int) :
8787

8888
} catch (e: Exception) {
8989
result = RemoteOperationResult(e)
90-
Timber.e(e, "Exception while getting OC user avatar");
90+
Timber.e(e, "Exception while getting OC user avatar")
9191

9292
} finally {
9393
try {
94-
client.exhaustResponse(inputStream);
95-
inputStream.close()
94+
client.exhaustResponse(inputStream)
95+
inputStream?.close()
9696
} catch (i: IOException) {
97-
Timber.e(i, "Unexpected exception closing input stream");
97+
Timber.e(i, "Unexpected exception closing input stream")
9898
}
9999
}
100100

0 commit comments

Comments
 (0)