Fixed potential crashed due to rare nil values at checkpoints.
[FIXED] Avoid nil values at checkpoints since they will cause crashes.
This commit is contained in:
parent
0a5329fe17
commit
2d8146edbd
@ -108,7 +108,8 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
||||
^(NSNotification *note) {
|
||||
[[self mainManagedObjectContext] saveToStore];
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification object:[UIApplication sharedApplication]
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserverForName:UIApplicationWillResignActiveNotification object:[UIApplication sharedApplication]
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:
|
||||
^(NSNotification *note) {
|
||||
[[self mainManagedObjectContext] saveToStore];
|
||||
@ -374,7 +375,7 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
||||
err(@"[StoreManager] ERROR: cause=%d, context=%@, error=%@", cause, context, error);
|
||||
MPCheckpoint( MPCheckpointMPErrorUbiquity, @{
|
||||
@"cause" : @(cause),
|
||||
@"error.domain" : error.domain,
|
||||
@"error.domain" : NilToNSNull(error.domain),
|
||||
@"error.code" : @(error.code)
|
||||
} );
|
||||
}
|
||||
@ -413,7 +414,8 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
||||
|
||||
NSManagedObjectID *elementOID = [element objectID];
|
||||
dispatch_async( dispatch_get_main_queue(), ^{
|
||||
completion( (MPElementEntity *)[[MPAppDelegate_Shared managedObjectContextForMainThreadIfReady] objectRegisteredForID:elementOID] );
|
||||
completion(
|
||||
(MPElementEntity *)[[MPAppDelegate_Shared managedObjectContextForMainThreadIfReady] objectRegisteredForID:elementOID] );
|
||||
} );
|
||||
}];
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[context saveToStore];
|
||||
|
||||
MPCheckpoint( MPCheckpointDeleteElement, @{
|
||||
@"type" : element.typeName,
|
||||
@"type" : NilToNSNull(element.typeName),
|
||||
@"version" : @(element.version)
|
||||
} );
|
||||
}];
|
||||
|
@ -319,7 +319,7 @@
|
||||
- (void)setHelpChapter:(NSString *)chapter {
|
||||
|
||||
MPCheckpoint( MPCheckpointHelpChapter, @{
|
||||
@"chapter" : chapter
|
||||
@"chapter" : NilToNSNull(chapter)
|
||||
} );
|
||||
|
||||
dispatch_async( dispatch_get_main_queue(), ^{
|
||||
@ -479,7 +479,7 @@
|
||||
[self showContentTip:@"Copied!" withIcon:nil];
|
||||
|
||||
MPCheckpoint( MPCheckpointCopyToPasteboard, @{
|
||||
@"type" : activeElement.typeName,
|
||||
@"type" : NilToNSNull(activeElement.typeName),
|
||||
@"version" : @(activeElement.version),
|
||||
@"emergency" : @NO
|
||||
} );
|
||||
@ -497,7 +497,7 @@
|
||||
[self showLoginNameTip:@"Copied!"];
|
||||
|
||||
MPCheckpoint( MPCheckpointCopyLoginNameToPasteboard, @{
|
||||
@"type" : activeElement.typeName,
|
||||
@"type" : NilToNSNull(activeElement.typeName),
|
||||
@"version" : @(activeElement.version)
|
||||
} );
|
||||
}
|
||||
@ -521,7 +521,7 @@
|
||||
++activeGeneratedElement.counter;
|
||||
|
||||
MPCheckpoint( MPCheckpointIncrementPasswordCounter, @{
|
||||
@"type" : activeGeneratedElement.typeName,
|
||||
@"type" : NilToNSNull(activeGeneratedElement.typeName),
|
||||
@"version" : @(activeGeneratedElement.version),
|
||||
@"counter" : @(activeGeneratedElement.counter)
|
||||
} );
|
||||
@ -553,7 +553,7 @@
|
||||
((MPElementGeneratedEntity *)activeElement_).counter = 1;
|
||||
|
||||
MPCheckpoint( MPCheckpointResetPasswordCounter, @{
|
||||
@"type" : activeElement_.typeName,
|
||||
@"type" : NilToNSNull(activeElement_.typeName),
|
||||
@"version" : @(activeElement_.version)
|
||||
} );
|
||||
return YES;
|
||||
@ -574,7 +574,7 @@
|
||||
[self.loginNameField becomeFirstResponder];
|
||||
|
||||
MPCheckpoint( MPCheckpointEditLoginName, @{
|
||||
@"type" : activeElement.typeName,
|
||||
@"type" : NilToNSNull(activeElement.typeName),
|
||||
@"version" : @(activeElement.version)
|
||||
} );
|
||||
}
|
||||
@ -655,7 +655,7 @@
|
||||
[self.contentField becomeFirstResponder];
|
||||
|
||||
MPCheckpoint( MPCheckpointEditPassword, @{
|
||||
@"type" : activeElement.typeName,
|
||||
@"type" : NilToNSNull(activeElement.typeName),
|
||||
@"version" : @(activeElement.version)
|
||||
} );
|
||||
}
|
||||
@ -680,7 +680,7 @@
|
||||
[activeElement_ migrateExplicitly:YES];
|
||||
|
||||
MPCheckpoint( MPCheckpointExplicitMigration, @{
|
||||
@"type" : activeElement_.typeName,
|
||||
@"type" : NilToNSNull(activeElement_.typeName),
|
||||
@"version" : @(activeElement_.version)
|
||||
} );
|
||||
return YES;
|
||||
@ -833,7 +833,7 @@
|
||||
}];
|
||||
|
||||
MPCheckpoint( MPCheckpointUseType, @{
|
||||
@"type" : element.typeName,
|
||||
@"type" : NilToNSNull(element.typeName),
|
||||
@"version" : @(element.version)
|
||||
} );
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import "MPPreferencesViewController.h"
|
||||
#import "MPiOSAppDelegate.h"
|
||||
#import "MPAppDelegate_Key.h"
|
||||
@ -99,7 +98,7 @@
|
||||
|
||||
if (motion == UIEventSubtypeMotionShake) {
|
||||
MPCheckpoint( MPCheckpointLogs, @{
|
||||
@"trace": [MPiOSConfig get].traceMode
|
||||
@"trace" : [MPiOSConfig get].traceMode
|
||||
} );
|
||||
[self performSegueWithIdentifier:@"MP_Logs" sender:self];
|
||||
}
|
||||
|
@ -6,16 +6,13 @@
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <Social/Social.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
#import "MPUnlockViewController.h"
|
||||
#import "MPiOSAppDelegate.h"
|
||||
#import "MPAppDelegate_Key.h"
|
||||
#import "MPAppDelegate_Store.h"
|
||||
|
||||
|
||||
@interface MPUnlockViewController()
|
||||
|
||||
@property(strong, nonatomic) NSMutableDictionary *avatarToUserOID;
|
||||
@ -30,7 +27,6 @@
|
||||
@property(nonatomic, strong) NSArray *marqueeTipTexts;
|
||||
@end
|
||||
|
||||
|
||||
@implementation MPUnlockViewController {
|
||||
NSManagedObjectID *_selectedUserOID;
|
||||
}
|
||||
@ -932,7 +928,7 @@
|
||||
}];
|
||||
|
||||
MPCheckpoint( MPCheckpointCopyToPasteboard, @{
|
||||
@"type" : [MPAlgorithmDefault nameOfType:self.emergencyType],
|
||||
@"type" : NilToNSNull([MPAlgorithmDefault nameOfType:self.emergencyType]),
|
||||
@"version" : @MPAlgorithmDefaultVersion,
|
||||
@"emergency" : @YES,
|
||||
} );
|
||||
|
@ -124,7 +124,7 @@
|
||||
if (message.level >= PearlLogLevelWarn)
|
||||
MPCheckpoint( @"Problem", @{
|
||||
@"level" : @(PearlLogLevelStr( message.level )),
|
||||
@"message" : message.message
|
||||
@"message" : NilToNSNull(message.message)
|
||||
} );
|
||||
|
||||
return YES;
|
||||
@ -207,25 +207,25 @@
|
||||
[[Crashlytics sharedInstance] setObjectValue:[PearlConfig get].reviewedVersion forKey:@"reviewedVersion"];
|
||||
|
||||
#ifdef TESTFLIGHT_SDK_VERSION
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPConfig get].rememberLogin)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].rememberLogin )
|
||||
forKey:@"rememberLogin"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringB([self storeManager].cloudEnabled)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringB( [self storeManager].cloudEnabled )
|
||||
forKey:@"iCloud"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPConfig get].iCloudDecided)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].iCloudDecided )
|
||||
forKey:@"iCloudDecided"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPiOSConfig get].sendInfo)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].sendInfo )
|
||||
forKey:@"sendInfo"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPiOSConfig get].helpHidden)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].helpHidden )
|
||||
forKey:@"helpHidden"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPiOSConfig get].showSetup)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].showSetup )
|
||||
forKey:@"showQuickStart"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([PearlConfig get].firstRun)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [PearlConfig get].firstRun )
|
||||
forKey:@"firstRun"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([PearlConfig get].launchCount)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [PearlConfig get].launchCount )
|
||||
forKey:@"launchCount"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([PearlConfig get].askForReviews)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [PearlConfig get].askForReviews )
|
||||
forKey:@"askForReviews"];
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB([PearlConfig get].reviewAfterLaunches)
|
||||
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [PearlConfig get].reviewAfterLaunches )
|
||||
forKey:@"reviewAfterLaunches"];
|
||||
[TestFlight addCustomEnvironmentInformation:[PearlConfig get].reviewedVersion
|
||||
forKey:@"reviewedVersion"];
|
||||
@ -271,17 +271,17 @@
|
||||
[[MPiOSAppDelegate get] showSetup];
|
||||
} );
|
||||
|
||||
MPCheckpoint(MPCheckpointStarted, @{
|
||||
@"simulator" : PearlStringB([PearlDeviceUtils isSimulator]),
|
||||
@"encrypted" : PearlStringB([PearlDeviceUtils isAppEncrypted]),
|
||||
@"jailbroken" : PearlStringB([PearlDeviceUtils isJailbroken]),
|
||||
MPCheckpoint( MPCheckpointStarted, @{
|
||||
@"simulator" : PearlStringB( [PearlDeviceUtils isSimulator] ),
|
||||
@"encrypted" : PearlStringB( [PearlDeviceUtils isAppEncrypted] ),
|
||||
@"jailbroken" : PearlStringB( [PearlDeviceUtils isJailbroken] ),
|
||||
@"platform" : [PearlDeviceUtils platform],
|
||||
#ifdef APPSTORE
|
||||
@"legal" : PearlStringB([PearlDeviceUtils isAppEncrypted]),
|
||||
#else
|
||||
@"legal" : @"YES",
|
||||
#endif
|
||||
});
|
||||
} );
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user