From: Dana Jansens Date: Wed, 25 Dec 2002 00:26:54 +0000 (+0000) Subject: return a NULL instead of segfaulting when asserts are off X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=efc875f5f273f3a5f62ae5c2937a771167740442;p=chaz%2Fopenbox return a NULL instead of segfaulting when asserts are off --- 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; }