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

Commit 079aa46

Browse files
committed
Adding assert
1 parent 5a3ac5e commit 079aa46

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

CodePush.m

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,11 @@ - (void)checkForPendingUpdate:(BOOL)needsRestart
103103
NSString *pendingHash = pendingUpdate[PendingUpdateHashKey];
104104
NSString *currentHash = [CodePushPackage getCurrentPackageHash:&error];
105105

106-
// If the current hash is equivalent to the pending hash, then the app
107-
// restart "picked up" the new update, but we need to kick off the
108-
// rollback timer and ensure that the necessary state is setup.
109-
if ([pendingHash isEqualToString:currentHash]) {
110-
int rollbackTimeout = [pendingUpdate[PendingUpdateRollbackTimeoutKey] intValue];
111-
[self initializeUpdateWithRollbackTimeout:rollbackTimeout needsRestart:needsRestart];
112-
} else {
113-
// NOTE: We shouldn't ever reach here
114-
}
106+
NSAssert([pendingHash isEqualToString:currentHash], @"There is a pending update but it's hash doesn't match that of the current package.");
107+
108+
// Kick off the rollback timer and ensure that the necessary state is setup for the pending update.
109+
int rollbackTimeout = [pendingUpdate[PendingUpdateRollbackTimeoutKey] intValue];
110+
[self initializeUpdateWithRollbackTimeout:rollbackTimeout needsRestart:needsRestart];
115111

116112
// Clear the pending update and sync
117113
[preferences removeObjectForKey:PendingUpdateKey];

0 commit comments

Comments
 (0)