X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetController.m;h=2ecb06057f80e90a909de3616713302d47a6af40;hp=86fe9688aaa21d029a125c90d635026b673d6119;hb=5bbd1edf2c0cc46fab98f712171a68f9182b0670;hpb=32ca88087708a8b1f7e65ecbea6c5fd6690431d3 diff --git a/TargetController.m b/TargetController.m index 86fe968..2ecb060 100644 --- a/TargetController.m +++ b/TargetController.m @@ -175,8 +175,13 @@ keyInput.vk = [(TargetKeyboard*)target vk]; } else if ([target isKindOfClass:[TargetConfig class]]) { [radioButtons selectCellAtRow:2 column:0]; - [configPopup selectItemAtIndex:[configsController.configs - indexOfObject:[(TargetConfig *)target config]]]; + NSUInteger idx = [configsController.configs + indexOfObject:[(TargetConfig *)target config]]; + if (idx == NSNotFound) { + [radioButtons selectCellAtRow:self.enabled ? 0 : -1 column:0]; + [configPopup selectItemAtIndex:-1]; + } else + [configPopup selectItemAtIndex:idx]; } else if ([target isKindOfClass:[TargetMouseMove class]]) { [radioButtons selectCellAtRow:3 column:0]; @@ -210,7 +215,6 @@ } - (void)refreshConfigs { - // TODO: This doesn't work when removing configs. NSInteger initialIndex = configPopup.indexOfSelectedItem; [configPopup.menu removeAllItems]; for (Config *config in configsController.configs) {