Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit ea2bc08

Browse files
Auto-merge pull request #2988 from livecodesebastien/fix-noui_crash
[[ no-UI Crash ]] bugfix 16017 causes a crash when LiveCode is run in… … no-UI mode should check whether a display has been returned before accessing its rectangle view
2 parents fd183df + 78921d4 commit ea2bc08

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

engine/src/stackview.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,18 @@ void MCStack::view_update_transform(void)
448448

449449
// PM-2015-07-17: [[ Bug 13754 ]] Make sure stack does not disappear off screen when changing the scalefactor
450450
MCRectangle t_bounded_rect, t_screen_rect;
451-
452-
// AL-2015-10-01: [[ Bug 16017 ]] Remember location of stacks on a second monitor
453-
t_screen_rect = MCscreen -> getnearestdisplay(t_view_rect) -> viewport;
454-
455-
t_bounded_rect = MCU_bound_rect(t_view_rect, t_screen_rect . x, t_screen_rect . y, t_screen_rect . width, t_screen_rect . height);
451+
452+
const MCDisplay* t_nearest_display = MCscreen -> getnearestdisplay(t_view_rect);
453+
if (t_nearest_display != NULL)
454+
{
455+
t_screen_rect = t_nearest_display -> viewport;
456+
t_bounded_rect = MCU_bound_rect(t_view_rect, t_screen_rect . x, t_screen_rect . y, t_screen_rect . width, t_screen_rect . height);
457+
}
458+
else
459+
{
460+
// In noUI mode, we don't have a nearest display.
461+
t_bounded_rect = MCU_bound_rect(t_view_rect, 0, 0, MCscreen -> getwidth(), MCscreen -> getheight());
462+
}
456463

457464
// IM-2014-01-16: [[ StackScale ]] Update view rect if needed
458465
view_setrect(t_bounded_rect);

0 commit comments

Comments
 (0)