From 228d6b2f29a89e1386c21fd3b36f173f27204c57 Mon Sep 17 00:00:00 2001 From: ehofman Date: Fri, 9 May 2003 08:31:56 +0000 Subject: [PATCH] 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. --- src/Main/viewmgr.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.39.5