Don't crash when we have no screens.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 19 Feb 2005 17:02:19 +0000 (17:02 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 19 Feb 2005 17:02:19 +0000 (17:02 +0000)
bigscreen/ccbs_bigscreen.cpp

index dfb025f..fbbc0aa 100644 (file)
@@ -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);