From: Steinar H. Gunderson Date: Sat, 19 Feb 2005 17:02:19 +0000 (+0000) Subject: Don't crash when we have no screens. X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=cf8f03564b5118b257d081037f0e7c5241ee6350 Don't crash when we have no screens. --- diff --git a/bigscreen/ccbs_bigscreen.cpp b/bigscreen/ccbs_bigscreen.cpp index dfb025f..fbbc0aa 100644 --- a/bigscreen/ccbs_bigscreen.cpp +++ b/bigscreen/ccbs_bigscreen.cpp @@ -51,11 +51,13 @@ void main_loop(pqxx::connection &conn) memset(framebuf, 0, 800*600*4); - if (screens[0]->check_invalidated()) { - screens[0]->draw(screenbuf); + if (screens.size() > 0) { + if (screens[0]->check_invalidated()) { + screens[0]->draw(screenbuf); + } + + memcpy(framebuf, screenbuf, 800*600*4); } - - memcpy(framebuf, screenbuf, 800*600*4); ptc_update(framebuf); conn.await_notification(0, 50000);