diff --git a/rtl/inc/getopts.pp b/rtl/inc/getopts.pp index ba3d128631..4732f9e98e 100644 --- a/rtl/inc/getopts.pp +++ b/rtl/inc/getopts.pp @@ -409,7 +409,7 @@ begin if opterr then writeln(argv[0],': option ',pfound^.name,' requires an argument'); nextchar:=0; - if optstring[1]=':' then + if (length(optstring)>0) and (optstring[1]=':') then Internal_getopt:=':' else Internal_getopt:='?';