From: Mikko Rasa Date: Sat, 14 Jul 2012 21:40:23 +0000 (+0300) Subject: Check that the option actually has a short name X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=commitdiff_plain;h=154d5f43f7a6633a4937499039fc1b1b713e0c0c;ds=sidebyside Check that the option actually has a short name --- diff --git a/source/core/getopt.cpp b/source/core/getopt.cpp index 911b673..766b858 100644 --- a/source/core/getopt.cpp +++ b/source/core/getopt.cpp @@ -21,7 +21,7 @@ GetOpt::OptBase &GetOpt::add_option(OptBase *opt) { for(list::iterator i=opts.begin(); i!=opts.end(); ) { - if((*i)->get_short()==opt->get_short() || (*i)->get_long()==opt->get_long()) + if((opt->get_short()!=0 && (*i)->get_short()==opt->get_short()) || (*i)->get_long()==opt->get_long()) { delete *i; opts.erase(i++);