From: ehofman Date: Fri, 9 May 2003 08:31:56 +0000 (+0000) Subject: Jim Wilson: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=228d6b2f29a89e1386c21fd3b36f173f27204c57;p=flightgear.git Jim Wilson: This is a patch to viewmgr.cxx that I've had for a long time. This just prevents a possible segfault caused by misconfiguration. --- diff --git a/src/Main/viewmgr.cxx b/src/Main/viewmgr.cxx index 790c990c5..b70daded8 100644 --- a/src/Main/viewmgr.cxx +++ b/src/Main/viewmgr.cxx @@ -632,7 +632,12 @@ FGViewMgr::getView () const void FGViewMgr::setView (int newview ) { - if ( newview < 0 || newview > (int)views.size() ) { + // if newview number too low wrap to last view... + if ( newview < 0 ) { + newview = (int)views.size() -1; + } + // if newview number to high wrap to zero... + if ( newview > ((int)views.size() -1) ) { newview = 0; } // set new view