nextcloud / nextcloud/android

NPE: general enhancements

Open
#2,223 12 comments 0 reactions 0 assignees View on GitHub
approved enhancement performance: NPE :no_entry_sign:
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

From google play console:
```
Caused by: java.lang.NullPointerException:
at com.owncloud.android.ui.activity.FileDisplayActivity$DownloadFinishReceiver.onReceive (FileDisplayActivity.java:1432)
```
which is
` getStorageManager().getFileByPath(mWaitingToSend.getRemotePath())`

This method can return null if the file does not exist in our database.

We could
- add @Nullable to method declaration
- throw IllegalArgumentException, which does not need to be handled
- throw FileNotFoundException, which needs to be handled

This is just an example, there are a lot more functions where we might return null and then have to check with "returnedObject != null".

This is not something we need to address now and should be discussed on case by case.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.