Skip to content

Commit c9767aa

Browse files
committed
Add resetting of window height/position on start if the values are screwy
1 parent 7f8256a commit c9767aa

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

WoWthing Sync/SyncForm.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,27 @@ private void LoadSettings()
142142
}
143143

144144
// Restore window size and position
145-
if (Properties.Settings.Default.WindowH > 0)
145+
if (Properties.Settings.Default.WindowH < 100 || Properties.Settings.Default.WindowX < 0 || Properties.Settings.Default.WindowY < 0)
146146
{
147-
Height = (int)Properties.Settings.Default.WindowH;
147+
if (Properties.Settings.Default.WindowH < 100)
148+
{
149+
Properties.Settings.Default.WindowH = 400;
150+
}
151+
152+
if (Properties.Settings.Default.WindowX < 0)
153+
{
154+
Properties.Settings.Default.WindowX = 0;
155+
}
156+
157+
if (Properties.Settings.Default.WindowY < 0)
158+
{
159+
Properties.Settings.Default.WindowY = 0;
160+
}
161+
162+
Properties.Settings.Default.Save();
148163
}
164+
165+
Height = (int)Properties.Settings.Default.WindowH;
149166
Left = (int)Properties.Settings.Default.WindowX;
150167
Top = (int)Properties.Settings.Default.WindowY;
151168

0 commit comments

Comments
 (0)