Browse Source

* fix for mantis #37233 crash in getopts.getlongopts with empty shortopts argument

git-svn-id: trunk@45683 -
marco 5 years ago
parent
commit
41406d161c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      rtl/inc/getopts.pp

+ 4 - 2
rtl/inc/getopts.pp

@@ -220,7 +220,9 @@ begin
   Last_nonopt:=1;
   OptOpt:='?';
   Nextchar:=0;
-  case opts[1] of
+  ordering:=permute;
+  if length(opts)>0 then
+   case opts[1] of
    '-' : begin
            ordering:=return_in_order;
            delete(opts,1,1);
@@ -230,7 +232,7 @@ begin
            delete(opts,1,1);
          end;
   else
-   ordering:=permute;
+    ordering:=permute; 
   end;
 end;