@@ -62,7 +62,7 @@ import { fromVersion, JsonProtoSerializer } from '../remote/serializer';
62
62
import { diffArrays } from '../util/array' ;
63
63
import { debugAssert , debugCast , hardAssert } from '../util/assert' ;
64
64
import { ByteString } from '../util/byte_string' ;
65
- import { logDebug } from '../util/log' ;
65
+ import { logDebug , logWarn } from '../util/log' ;
66
66
import { primitiveComparator } from '../util/misc' ;
67
67
import { ObjectMap } from '../util/obj_map' ;
68
68
import { SortedMap } from '../util/sorted_map' ;
@@ -1029,22 +1029,22 @@ export async function localStoreReleaseTarget(
1029
1029
) : Promise < void > {
1030
1030
const localStoreImpl = debugCast ( localStore , LocalStoreImpl ) ;
1031
1031
const targetData = localStoreImpl . targetDataByTarget . get ( targetId ) ;
1032
- debugAssert (
1033
- targetData !== null ,
1034
- `Tried to release nonexistent target: ${ targetId } `
1035
- ) ;
1032
+
1033
+ if ( targetData === null ) {
1034
+ logWarn ( `Tried to release nonexistent target: ${ targetId } ` ) ;
1035
+ }
1036
1036
1037
1037
const mode = keepPersistedTargetData ? 'readwrite' : 'readwrite-primary' ;
1038
1038
1039
1039
try {
1040
- if ( ! keepPersistedTargetData ) {
1040
+ if ( ! keepPersistedTargetData && targetData ) {
1041
1041
await localStoreImpl . persistence . runTransaction (
1042
1042
'Release target' ,
1043
1043
mode ,
1044
1044
txn => {
1045
1045
return localStoreImpl . persistence . referenceDelegate . removeTarget (
1046
1046
txn ,
1047
- targetData !
1047
+ targetData
1048
1048
) ;
1049
1049
}
1050
1050
) ;
@@ -1067,7 +1067,10 @@ export async function localStoreReleaseTarget(
1067
1067
1068
1068
localStoreImpl . targetDataByTarget =
1069
1069
localStoreImpl . targetDataByTarget . remove ( targetId ) ;
1070
- localStoreImpl . targetIdByTarget . delete ( targetData ! . target ) ;
1070
+
1071
+ if ( targetData ) {
1072
+ localStoreImpl . targetIdByTarget . delete ( targetData ! . target ) ;
1073
+ }
1071
1074
}
1072
1075
1073
1076
/**
0 commit comments