-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Non-nil empty strings cause Firestore to crash instead of throwing an error gracefully #8218
Labels
Comments
Seems to be a common issue. |
Thanks for reporting this -- we can add a check for an empty string. |
Woohoo! Thank you! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Environment
Swift Package Manager
The Problem
Currently, attempting a Firestore document load (of any nature) with an empty ID causes a runtime exception which results in a crash. By "empty ID" I am referring to a string whose character count is zero, but where the object is non-nil. Literally, an empty string.
While Firestore handles a number of errors and returns the failure results gracefully in many cases, this is not one of those. It would be nice if the SDK could catch this and return an error
Steps to reproduce:
.document(ID)
, supply a non-nil but empty string such as""
.Relevant Code
It appears, from crash logs that this occurs deep in the Firestore framework (
core/src/api/collection_reference.cc
):return DocumentReference(std::move(path), firestore());
There seems to be an attempt to handle the issue and fail gracefully in
Source/API/FIRCollectionReference.mm
):Unfortunately,
if(!documentPath)
does not handle cases where strings may be non-nil, yet still empty (something I think may have been made possible in a recent Swift release 🥴?).The text was updated successfully, but these errors were encountered: