Skip to content

Commit

Permalink
Merge pull request #15 from aogilvie/fix/nullObjectAssignmentForOptions
Browse files Browse the repository at this point in the history
fix bug where not passing options or passing null would crash application
  • Loading branch information
aogilvie committed Mar 11, 2014
2 parents 24a3f0a + cbffbe6 commit 09fccab
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,13 @@ - (void)hideView:(CDVInvokedUrlCommand *)command {
// Assign new hide callback
self.hideViewCallbackId = command.callbackId;

NSDictionary *options;
NSDictionary *options = NULL;
if ([command.arguments count] > 0) {
// Assign options
options = [command.arguments objectAtIndex:1];
}

if (options) {
if (![options isKindOfClass:[NSNull class]]) {
NSDictionary *animationDict = [options objectForKey:@"animation"];
if (animationDict) {
NSString *type = [animationDict objectForKey:@"type"];
Expand Down Expand Up @@ -356,12 +356,12 @@ - (void)showView:(CDVInvokedUrlCommand *)command {
// Assign new show callback
self.showViewCallbackId = command.callbackId;

NSDictionary *options;
NSDictionary *options = NULL;
if ([command.arguments count] > 0) {
// Assign options
options = [command.arguments objectAtIndex:1];
}
if (options) {
if (![options isKindOfClass:[NSNull class]]) {
NSDictionary* animationDict = [options objectForKey:@"animation"];
if (animationDict) {

Expand Down Expand Up @@ -453,14 +453,14 @@ - (void)load:(CDVInvokedUrlCommand *)command {
// assign arguments
NSString *viewName = [command.arguments objectAtIndex:0];

NSDictionary* options;
NSDictionary *options = NULL;
if ([command.arguments count] > 0) {
options = [command.arguments objectAtIndex:1];
}

WizLog(@"[WizCanvasPlugin] ******* Load into canvas : %@ - viewlist -> %@ options %@", viewName, wizViewList, options);

if (options) {
if (![options isKindOfClass:[NSNull class]]) {
// Find the correct view
if ([wizViewList objectForKey:viewName]) {

Expand Down

0 comments on commit 09fccab

Please sign in to comment.