appwrite / sdk-for-android

[READ-ONLY] Official Appwrite Android SDK 💚 🤖
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
98 stars 21 forks source link

🐛 Bug Report: Getting java.lang.NullPointerException when using Query.select on attributes along with limit query #56

Open bigraymasoom opened 2 weeks ago

bigraymasoom commented 2 weeks ago

👟 Reproduction steps

  1. Call the listDocuments function with parameters that include database and collection IDs, a numeric limit, and a list of attributes.
  2. Include attribute selection in the query, where attribute names are passed dynamically to the Query.select method.
  3. Execute the function, which internally calls toJson() on the Query object.

👍 Expected behavior

Expected Behavior: The function should handle null values gracefully and not attempt to cast nulls to non-null strings. If a parameter is null, it should either be managed by default values or handled with appropriate error messages.

👎 Actual Behavior

Actual Behavior: The application throws a java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String during the execution of the toJson() method in the Query class. This error suggests that there might be issues with how null values are being managed within query parameters or during their serialization/deserialization process.

🎲 Appwrite version

Version 1.5.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

🏢 Have you read the Code of Conduct?

bigraymasoom commented 2 weeks ago

Android SDK version I am using is 5.1.1