summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/cmndline.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/cmndline.cc')
-rw-r--r--apt-pkg/contrib/cmndline.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc
index 159f330a1..b8c7f7984 100644
--- a/apt-pkg/contrib/cmndline.cc
+++ b/apt-pkg/contrib/cmndline.cc
@@ -92,8 +92,9 @@ bool CommandLine::Parse(int argc,const char **argv)
// Match up to a = against the list
Args *A;
const char *OptEnd = strchrnul(Opt, '=');
- for (A = ArgList; A->end() == false &&
- stringcasecmp(Opt,OptEnd,A->LongOpt) != 0; A++);
+ for (A = ArgList; A->end() == false &&
+ (A->LongOpt == 0 || stringcasecmp(Opt,OptEnd,A->LongOpt) != 0);
+ ++A);
// Failed, look for a word after the first - (no-foo)
bool PreceedMatch = false;