From bfd8eb63c6ee79e58033020c9ae9524b691dbb96 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 13 Sep 2018 10:07:46 -0500 Subject: [PATCH] Add some comments/nullability annotations for clarity --- SignalServiceKit/src/Account/TSPreKeyManager.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SignalServiceKit/src/Account/TSPreKeyManager.m b/SignalServiceKit/src/Account/TSPreKeyManager.m index 35a6ca311..43005acdd 100644 --- a/SignalServiceKit/src/Account/TSPreKeyManager.m +++ b/SignalServiceKit/src/Account/TSPreKeyManager.m @@ -188,13 +188,15 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5; + (void)clearSignedPreKeyRecords { OWSPrimaryStorage *primaryStorage = [OWSPrimaryStorage sharedManager]; - NSNumber *currentSignedPrekeyId = [primaryStorage currentSignedPrekeyId]; + NSNumber *_Nullable currentSignedPrekeyId = [primaryStorage currentSignedPrekeyId]; [self clearSignedPreKeyRecordsWithKeyId:currentSignedPrekeyId]; } -+ (void)clearSignedPreKeyRecordsWithKeyId:(NSNumber *)keyId ++ (void)clearSignedPreKeyRecordsWithKeyId:(NSNumber *_Nullable)keyId { if (!keyId) { + // currentSignedPreKeyId should only be nil before we've completed registration. + // We have this guard here for robustness, but we should never get here. OWSFailDebug(@"Ignoring request to clear signed preKeys since no keyId was specified"); return; }