Skip to content
This repository was archived by the owner on Feb 20, 2022. It is now read-only.

Commit 1bfa012

Browse files
committed
Use simplified check for null
1 parent d6cbb6e commit 1bfa012

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

unity-project/Assets/Moulin/DDP/local-db/TypedCollection.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ public TypedCollection(LocalDB db, string collectionName,
5656

5757
public void Add(string docId, JSONObject fields) {
5858
DocType document = JSONObjectToDocument(fields);
59-
if (OnAdded != null) {
60-
OnAdded(document);
61-
}
62-
documents.Add(docId, document);
59+
OnAdded?.Invoke(document);
60+
documents.Add(docId, document);
6361
}
6462

6563
public void Change(string docId, JSONObject fields, JSONObject cleared) {
@@ -84,21 +82,17 @@ public void Change(string docId, JSONObject fields, JSONObject cleared) {
8482

8583
DocType newDocument = JSONObjectToDocument(jsonDocument);
8684

87-
if (OnChanged != null) {
88-
OnChanged(oldDocument, newDocument);
89-
}
85+
OnChanged?.Invoke(oldDocument, newDocument);
9086

91-
documents[docId] = newDocument;
87+
documents[docId] = newDocument;
9288
}
9389

9490
public void Remove(string docId) {
9591
DocType document = documents[docId];
9692

97-
if (OnRemoved != null) {
98-
OnRemoved(document);
99-
}
93+
OnRemoved?.Invoke(document);
10094

101-
documents.Remove(docId);
95+
documents.Remove(docId);
10296
}
10397

10498
public void AddBefore(string docId, JSONObject fields, string before) {

0 commit comments

Comments
 (0)