From dc683b3d137c75bb753851306fe17c1026f5582b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= <gambas@users.sourceforge.net>
Date: Wed, 21 Jun 2017 13:31:55 +0000
Subject: [PATCH] [GB.SETTINGS] * BUG: Don't crash if the window screen number
 is incorrect.

git-svn-id: svn://localhost/gambas/trunk@8146 867c0c6c-44f3-4631-809d-bfa615b0a4ec
---
 comp/src/gb.settings/.src/Settings.class | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/comp/src/gb.settings/.src/Settings.class b/comp/src/gb.settings/.src/Settings.class
index 3014c91f7..4355da51f 100644
--- a/comp/src/gb.settings/.src/Settings.class
+++ b/comp/src/gb.settings/.src/Settings.class
@@ -390,8 +390,12 @@ Private Sub WriteWindow(hWindow As Window, sKey As String)
   
     S = hWindow.Screen
     
-    X -= Screens[S].AvailableX
-    Y -= Screens[S].AvailableY
+    If S >= 0 Then
+      X -= Screens[S].AvailableX
+      Y -= Screens[S].AvailableY
+    Else
+      S = 0
+    Endif
     
   Endif