@@ -62,7 +62,7 @@ import { fromVersion, JsonProtoSerializer } from '../remote/serializer';
6262import { diffArrays } from '../util/array' ;
6363import { debugAssert , debugCast , hardAssert } from '../util/assert' ;
6464import { ByteString } from '../util/byte_string' ;
65- import { logDebug } from '../util/log' ;
65+ import { logDebug , logWarn } from '../util/log' ;
6666import { primitiveComparator } from '../util/misc' ;
6767import { ObjectMap } from '../util/obj_map' ;
6868import { SortedMap } from '../util/sorted_map' ;
@@ -1029,22 +1029,22 @@ export async function localStoreReleaseTarget(
10291029) : Promise < void > {
10301030 const localStoreImpl = debugCast ( localStore , LocalStoreImpl ) ;
10311031 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+ }
10361036
10371037 const mode = keepPersistedTargetData ? 'readwrite' : 'readwrite-primary' ;
10381038
10391039 try {
1040- if ( ! keepPersistedTargetData ) {
1040+ if ( ! keepPersistedTargetData && targetData ) {
10411041 await localStoreImpl . persistence . runTransaction (
10421042 'Release target' ,
10431043 mode ,
10441044 txn => {
10451045 return localStoreImpl . persistence . referenceDelegate . removeTarget (
10461046 txn ,
1047- targetData !
1047+ targetData
10481048 ) ;
10491049 }
10501050 ) ;
@@ -1067,7 +1067,10 @@ export async function localStoreReleaseTarget(
10671067
10681068 localStoreImpl . targetDataByTarget =
10691069 localStoreImpl . targetDataByTarget . remove ( targetId ) ;
1070- localStoreImpl . targetIdByTarget . delete ( targetData ! . target ) ;
1070+
1071+ if ( targetData ) {
1072+ localStoreImpl . targetIdByTarget . delete ( targetData ! . target ) ;
1073+ }
10711074}
10721075
10731076/**
0 commit comments