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

MoralisQuery FirstOrDefaultAsync don't check if the item is null #53

Open
Zarbuz opened this issue Aug 1, 2022 · 2 comments
Open

MoralisQuery FirstOrDefaultAsync don't check if the item is null #53

Zarbuz opened this issue Aug 1, 2022 · 2 comments
Assignees

Comments

@Zarbuz
Copy link

Zarbuz commented Aug 1, 2022

In the class MoralisQuery in the FirstOrDefaultAsync method, the SDK doens't check if the item is null which causes a NullRefException.

What the function should be :

public async UniTask<T> FirstOrDefaultAsync(CancellationToken cancellationToken)
        {
            EnsureNotInstallationQuery();
            T item = await QueryService.FirstAsync<T>(this, SessionToken, cancellationToken);

            if (item != null)
            {
	            item.ObjectService = this.QueryService.ObjectService;
	            item.sessionToken = this.SessionToken;
	            return item;
            }

            return null;
        }
@xactant
Copy link
Contributor

xactant commented Aug 26, 2022

Thank you for reporting this. We will look into this.

@Zarbuz
Copy link
Author

Zarbuz commented Sep 28, 2022

Any news for a fix for this ? I am forced to maintain a local version of the SDK for my project with this fix. Not a big problem in itself but I have to think about it with each SDK update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants