Skip to content

Commit

Permalink
Fix null/empty doc null ref
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangSenff authored Jul 18, 2024
1 parent d610db3 commit b2cb040
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions addons/godot-firebase/firestore/firestore_document.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ var collection_name : String # Name of the collection to which it belongs
signal changed(changes)

func _init(doc : Dictionary = {}):
document = doc.fields
doc_name = doc.name
if doc_name.count("/") > 2:
doc_name = (doc_name.split("/") as Array).back()
if doc.has("fields"):
document = doc.fields
if doc.has("name"):
doc_name = doc.name
if doc_name.count("/") > 2:
doc_name = (doc_name.split("/") as Array).back()

self.create_time = doc.createTime

Expand Down

0 comments on commit b2cb040

Please sign in to comment.