summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/ncon.pas9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/ncon.pas b/compiler/ncon.pas
index 9cd1a32b6a..7b576d1c8d 100644
--- a/compiler/ncon.pas
+++ b/compiler/ncon.pas
@@ -244,7 +244,6 @@ implementation
pWideStringVal: pcompilerwidestring;
ordValRecord: TConstExprInt;
begin
- get_string_value := '';
if is_conststring_or_constcharnode(p) then
begin
if is_constcharnode(p) or is_constwidecharnode(p) then
@@ -303,7 +302,7 @@ implementation
else
begin
getmem(pCharVal, tstringconstnode(p).len + 1);
- strcopy(pCharVal, tstringconstnode(p).value_str);
+ move(pCharVal^, tstringconstnode(p).value_str^, tstringconstnode(p).len);
pCharVal[tstringconstnode(p).len] := #0;
get_string_value := pCharVal;
end;
@@ -311,7 +310,11 @@ implementation
end;
end
else
- Message(type_e_string_expr_expected);
+ begin
+ Message(type_e_string_expr_expected);
+ getmem(get_string_value, 1);
+ get_string_value[0] := #0;
+ end;
end;
function is_constresourcestringnode(p : tnode) : boolean;