diff options
author | Steven Noonan <steven@uplinklabs.net> | 2009-10-01 19:31:54 -0700 |
---|---|---|
committer | Steven Noonan <steven@uplinklabs.net> | 2009-10-01 19:35:22 -0700 |
commit | b4e0ccc78a6f5c5951d1267b683bdcc845b24093 (patch) | |
tree | 6e181ea32d1ecd0b2955ded58d7512962e04797d /crawl-ref/source/tilesdl.cc | |
parent | 2ba02b60b6bcd926aaf651cfaf0e9f514d09abfd (diff) | |
download | crawl-ref-b4e0ccc78a6f5c5951d1267b683bdcc845b24093.tar.gz crawl-ref-b4e0ccc78a6f5c5951d1267b683bdcc845b24093.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>
Diffstat (limited to 'crawl-ref/source/tilesdl.cc')
-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 d9e3d26e4b..953c5ba563 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -1012,7 +1012,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; |