Browse Source

Avoid unnecessary call when length(s) is zero, which avoids range check error

Pierre Muller 1 year ago
parent
commit
83d3a39417
1 changed files with 5 additions and 2 deletions
  1. 5 2
      compiler/utils/msg2inc.pp

+ 5 - 2
compiler/utils/msg2inc.pp

@@ -194,8 +194,11 @@ begin
          end
         else if (s='') or (s[1] <> '#') then
          begin
-           move(s[1],ptxt^,length(s));
-           inc(ptxt,length(s));
+           if length(s)>0 then
+             begin
+               move(s[1],ptxt^,length(s));
+               inc(ptxt,length(s));
+             end;
            ptxt^:=#10;
            inc(ptxt);
          end;