historyService: check if this.snapshots[snapshot] is defined

This commit is contained in:
Jesse Chan
2020-10-27 14:27:01 +08:00
parent fe01c0774c
commit 56306af3b2

View File

@@ -128,7 +128,7 @@ class HistoryService extends BaseService<HistoryServiceEvents> {
}
getHistory({snapshot}: {snapshot: HistorySnapshot}, callback: (data: TransferHistory | null, error?: Error) => void) {
this.snapshots[snapshot].getData((transferSnapshots, error) => {
this.snapshots[snapshot]?.getData((transferSnapshots, error) => {
if (error || transferSnapshots == null) {
callback(null, error);
return;