fix crash

This commit is contained in:
dante ruiz 2019-06-25 13:37:45 -07:00
parent ca797e30e4
commit 68d620fca3
2 changed files with 18 additions and 11 deletions

View file

@ -6,14 +6,20 @@
@implementation LatestBuildRequest
- (NSInteger) getCurrentVersion {
NSInteger currentVersion;
@try {
NSString* interfaceAppPath = [[Launcher.sharedLauncher getAppPath] stringByAppendingString:@"interface.app"];
NSError * error = nil;
Interface * interface = [[Interface alloc] initWith:interfaceAppPath];
NSInteger currentVersion = [interface getVersion:&error];
currentVersion = [interface getVersion:&error];
if (currentVersion == 0 && error != nil) {
NSLog(@"can't get version from interface, falling back to settings: %@", error);
currentVersion = [Settings.sharedSettings latestBuildVersion];
}
} @catch (NSException *exception) {
NSLog(@"an exception was thrown");
currentVersion = [Settings.sharedSettings latestBuildVersion];
}
return currentVersion;
}
@ -58,6 +64,7 @@
BOOL appDirectoryExist = [fileManager fileExistsAtPath:[[sharedLauncher getAppPath] stringByAppendingString:@"interface.app"]];
dispatch_async(dispatch_get_main_queue(), ^{
NSInteger currentVersion = [self getCurrentVersion];
NSLog(@"Latest Build Request -> does build directory exist: %@", appDirectoryExist ? @"TRUE" : @"FALSE");
NSLog(@"Latest Build Request -> current version: %ld", currentVersion);