Index: src/OFOptionsParser.m ================================================================== --- src/OFOptionsParser.m +++ src/OFOptionsParser.m @@ -99,31 +99,36 @@ iter2->longOption = nil; iter2->hasArgument = iter->hasArgument; iter2->isSpecifiedPtr = iter->isSpecifiedPtr; iter2->argumentPtr = iter->argumentPtr; - @try { - iter2->longOption = [iter->longOption copy]; - - if ([_longOptions - valueForKey: iter2->longOption] != NULL) - @throw [OFInvalidArgumentException - exception]; - - [_longOptions setValue: iter2 - forKey: iter2->longOption]; - } @catch (id e) { - /* - * Make sure we are in a consistent state where - * dealloc works. - */ - [iter2->longOption release]; - - iter2->shortOption = '\0'; - iter2->longOption = nil; - - @throw e; + if (iter->longOption != nil) { + @try { + iter2->longOption = + [iter->longOption copy]; + + if ([_longOptions valueForKey: + iter2->longOption] != NULL) + @throw + [OFInvalidArgumentException + exception]; + + [_longOptions + setValue: iter2 + forKey: iter2->longOption]; + } @catch (id e) { + /* + * Make sure we are in a consistent + * state where dealloc works. + */ + [iter2->longOption release]; + + iter2->shortOption = '\0'; + iter2->longOption = nil; + + @throw e; + } } } _arguments = [[OFApplication arguments] retain]; } @catch (id e) {