Skip to content

Commit

Permalink
Merge pull request #31 from omergul123/develop
Browse files Browse the repository at this point in the history
added control for onError closure
  • Loading branch information
omergul committed Mar 9, 2015
2 parents 612956e + a1558ac commit b9e67b3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions LLSimpleCamera/LLSimpleCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ - (void)start {
NSError *error = [NSError errorWithDomain:LLSimpleCameraErrorDomain
code:LLSimpleCameraErrorCodePermission
userInfo:nil];
dispatch_async(dispatch_get_main_queue(), ^{
self.onError(self, error);
});

if(self.onError) {
dispatch_async(dispatch_get_main_queue(), ^{
self.onError(self, error);
});
}
}
}];
} else {
Expand Down Expand Up @@ -363,7 +366,9 @@ - (BOOL)updateFlashMode:(CameraFlash)cameraFlash {
return YES;
}
else {
self.onError(self, error);
if(self.onError) {
self.onError(self, error);
}
return NO;
}
}
Expand Down

0 comments on commit b9e67b3

Please sign in to comment.