From 215f248dff2fcda35aa75202ad980827456841cc Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Thu, 1 Oct 2009 19:31:54 -0700 Subject: tilesdl.cc: fix segfault caused by negative Y-value In my case, the cause was a crawlrc with these values: view_max_width=80 view_max_height=70 I did a USE_TILE build, ran it, and the value of crawl_view.msgsz.y became negative, causing a rather nasty segfault later in initialization. I'm pretty sure that using 'std::max' here is not the best solution, but it at least avoids the negative number case. Signed-off-by: Steven Noonan --- crawl-ref/source/tilesdl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index a1cae698be..41ea5b47fa 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -1006,7 +1006,7 @@ void TilesFramework::do_layout() crawl_view.viewsz.y = Options.view_max_height; crawl_view.msgsz.x = crt_width; // What *does* msgsz.y get set to? (jpeg) - crawl_view.msgsz.y = crt_height - crawl_view.viewsz.y; + crawl_view.msgsz.y = std::max(5, crt_height - crawl_view.viewsz.y); // Initial sizes. m_region_tile->dx = m_viewsc.x; -- cgit v1.2.3-54-g00ecf