Bläddra i källkod

check index of monitor

circular17 3 år sedan
förälder
incheckning
27f6d2c39b
1 ändrade filer med 8 tillägg och 1 borttagningar
  1. 8 1
      lazpaint/ucommandline.pas

+ 8 - 1
lazpaint/ucommandline.pas

@@ -5,7 +5,7 @@ unit UCommandline;
 
 interface
 
-uses classes, LazpaintType, uresourcestrings;
+uses classes, LazpaintType, uresourcestrings, LCLStrConsts;
 
 {$IFDEF WINDOWS}
   {$DEFINE SHOW_MANUAL_IN_WINDOW}
@@ -237,6 +237,13 @@ var
         errorEncountered := true;
         exit(false);
       end;
+      if (screenIndex < 0) or (screenIndex >= Screen.MonitorCount) then
+      begin
+        instance.ShowError('Screenshot', '"Screenshot" ' +
+                                         lclstrconsts.rsListIndexExceedsBounds.Replace('%d', inttostr(screenIndex)));
+        errorEncountered := true;
+        exit(false);
+      end;
       r := Screen.Monitors[screenIndex].BoundsRect;
       r := rect(r.Left*CanvasScale, r.Top*CanvasScale,
                 r.Right*CanvasScale, r.Bottom*CanvasScale);