]> Dogcows Code - chaz/openbox/commitdiff
return a NULL instead of segfaulting when asserts are off
authorDana Jansens <danakj@orodu.net>
Wed, 25 Dec 2002 00:26:54 +0000 (00:26 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 25 Dec 2002 00:26:54 +0000 (00:26 +0000)
src/openbox.hh

index 40eb1804c3052ac401060249f284c19e40f1aa75..1489ffb744b1af37301053cbf99b5a3f794529cb 100644 (file)
@@ -171,9 +171,16 @@ public:
   //! Returns a managed screen
   inline OBScreen *screen(int num) {
     assert(num >= 0); assert(num < (signed)_screens.size());
+    if (num >= screenCount())
+      return NULL;
     return _screens[num];
   }
 
+  //! Returns the number of managed screens
+  inline int screenCount() const {
+    return (signed)_screens.size();
+  }
+
   //! Returns the mouse cursors used throughout Openbox
   inline const Cursors &cursors() const { return _cursors; }
 
This page took 0.023017 seconds and 4 git commands to generate.