Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of listFiles() without the ID column results in a null pointer casting crash. #50

Closed
EternityForest opened this issue May 30, 2022 · 4 comments · Fixed by #52
Closed
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@EternityForest
Copy link

EternityForest commented May 30, 2022

Describe the bug
Specifically, we get an error trying to cast a null to a Kotlin String on that appears to be from line 212(https://github.com/lakscastro/shared-storage/blob/1bfeb88df69938c62d7709861cc426ec71515f3c/android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib/DocumentCommon.kt), if one tries to iterate anything without enabling the id column.

val id =
          data[DocumentsContract.Document.COLUMN_DOCUMENT_ID] as String

Seems to be the culprit line.

I'm not actually sure this is really a bug, it might be simpler just to document that the Id column is needed.

@EternityForest EternityForest added the bug Something isn't working label May 30, 2022
@alexrintt alexrintt removed their assignment May 30, 2022
@alexrintt alexrintt added the good first issue Good for newcomers label May 30, 2022
@alexrintt
Copy link
Owner

alexrintt commented May 30, 2022

Indeed it is. I'll update the docs to something like: 'Id is optional, since it'll be queried even when not explicity requested'.

I pushed some commits to make it optional.

Thanks, @EternityForest!

Repository owner deleted a comment from allcontributors bot May 30, 2022
@alexrintt
Copy link
Owner

@all-contributors please add @EternityForest for bug

@allcontributors
Copy link
Contributor

@lakscastro

I've put up a pull request to add @EternityForest! 🎉

@alexrintt
Copy link
Owner

Fixed by #52, #53 and published by #54.

If you have anything to add, you can reopen this issue.

If you found a new bug, you can open a new issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants