summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-12-25 00:26:54 +0000
committerDana Jansens <danakj@orodu.net>2002-12-25 00:26:54 +0000
commitefc875f5f273f3a5f62ae5c2937a771167740442 (patch)
treec209d9eec26af04e8a03beaed892b3c10b9c1b88 /src
parentbcb8de973abcbf6bc0cb1c46e764276c34fa5380 (diff)
return a NULL instead of segfaulting when asserts are off
Diffstat (limited to 'src')
-rw-r--r--src/openbox.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/openbox.hh b/src/openbox.hh
index 40eb1804..1489ffb7 100644
--- a/src/openbox.hh
+++ b/src/openbox.hh
@@ -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; }