appwrite / appwrite/sdk-for-android

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

Open
#56 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
154
Forks
30
Avg merge
5h 41m
Merged PRs (30d)
3

Description

### 👟 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?

- [X] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [X] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)

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.