Fix crash when no action is available.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Wed, 27 Feb 2013 22:54:38 +0000 (23:54 +0100)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Wed, 27 Feb 2013 22:54:38 +0000 (23:54 +0100)
JoystickController.m

index dfa246f6f622b909407153c735f00225d5bdd34a..8b350a489788f25f33373a7cf4cc0e168a7b1b55 100644 (file)
@@ -60,7 +60,7 @@ static void input_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDVa
     if (((ApplicationController *)[NSApplication sharedApplication].delegate).active) {
         JSAction *mainAction = [js actionForEvent:value];
         [mainAction notifyEvent:value];
-        NSArray *children = mainAction.children ? mainAction.children : @[mainAction];
+        NSArray *children = mainAction.children ? mainAction.children : mainAction ? @[mainAction] : @[];
         for (JSAction *subaction in children) {
             Target *target = [controller.currentConfig getTargetForAction:subaction];
             target.magnitude = mainAction.magnitude;