From 7394afbbc80be994cea0a83a91fadaf9aeccffdd Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 4 Jan 2019 14:47:36 +0100 Subject: GLK: Fix negative index crash when clicking in a window --- engines/glk/window_pair.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/glk') diff --git a/engines/glk/window_pair.cpp b/engines/glk/window_pair.cpp index 7ddd57b23c..d571dc58e7 100644 --- a/engines/glk/window_pair.cpp +++ b/engines/glk/window_pair.cpp @@ -245,7 +245,7 @@ void PairWindow::setArrangement(uint method, uint size, Window *keyWin) { } void PairWindow::click(const Point &newPos) { - for (int ctr = 0, idx = (!_backward ? (int)_children.size() - 1 : 0); ctr < (int)_children.size(); + for (int ctr = 0, idx = (_backward ? (int)_children.size() - 1 : 0); ctr < (int)_children.size(); ++ctr, idx += (_backward ? -1 : 1)) { Window *w = _children[idx]; if (w->_bbox.contains(newPos)) -- cgit v1.2.3