diff options
author | Steven Noonan <steven@uplinklabs.net> | 2009-10-01 19:31:54 -0700 |
---|---|---|
committer | Steven Noonan <steven@uplinklabs.net> | 2009-10-03 19:09:54 -0700 |
commit | 215f248dff2fcda35aa75202ad980827456841cc (patch) | |
tree | 0f65d1d0e918344e664ba52c63eb700fd675fc19 | |
parent | 07441c4eb18884a509b30eb215e789ac25aec9eb (diff) | |
download | crawl-ref-215f248dff2fcda35aa75202ad980827456841cc.tar.gz crawl-ref-215f248dff2fcda35aa75202ad980827456841cc.zip |
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 <steven@uplinklabs.net>
-rw-r--r-- | crawl-ref/source/tilesdl.cc | 2 |
1 files changed, 1 insertions, 1 deletions
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; |