summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/fpg_memo.pas6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/fpg_memo.pas b/src/gui/fpg_memo.pas
index a4c3dc26..df16367b 100644
--- a/src/gui/fpg_memo.pas
+++ b/src/gui/fpg_memo.pas
@@ -1579,6 +1579,12 @@ var
st: integer;
s: TfpgString;
begin
+ if FSelEndLine = -1 then { no text is selected }
+ begin
+ Result := '';
+ Exit;
+ end;
+
if (FSelStartLine shl 16) + FSelStartPos <= (FSelEndLine shl 16) + FSelEndPos then
begin
selsl := FSelStartLine;