From 41406d161c4918ed009878bafdcfd9cdfe3086e2 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 23 Jun 2020 09:01:37 +0000 Subject: [PATCH] * fix for mantis #37233 crash in getopts.getlongopts with empty shortopts argument git-svn-id: trunk@45683 - --- rtl/inc/getopts.pp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rtl/inc/getopts.pp b/rtl/inc/getopts.pp index 888029c710..ecf3e43288 100644 --- a/rtl/inc/getopts.pp +++ b/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;