Corrected a NULL pointer dereference

This commit is contained in:
Th3maz1ng 2022-03-30 12:15:09 +02:00
parent e5d250556f
commit 1c1945d0ca

View File

@ -292,7 +292,9 @@ void ScreenManager::displayNextView()
{ {
_forceRefresh = true; _forceRefresh = true;
_error = OK; _error = OK;
if(_currentView == NO_CURRENT_VIEW && !isListEmpty(_viewLinkedList)) if(isListEmpty(_viewLinkedList))return;
if(_currentView == NO_CURRENT_VIEW)
{ {
_currentView = _viewLinkedList; _currentView = _viewLinkedList;
} }
@ -301,7 +303,7 @@ void ScreenManager::displayNextView()
_currentView = _currentView->next; _currentView = _currentView->next;
} }
//End of the views, we cycle again :) //End of the views, we cycle again :)
else if(isListEmpty(_currentView->next) && !isListEmpty(_viewLinkedList)) else if(isListEmpty(_currentView->next))
{ {
_currentView = _viewLinkedList; _currentView = _viewLinkedList;
} }
@ -323,7 +325,9 @@ void ScreenManager::displayPreviousView()
{ {
_forceRefresh = true; _forceRefresh = true;
_error = OK; _error = OK;
if(_currentView == NO_CURRENT_VIEW && !isListEmpty(_tail)) if(isListEmpty(_tail))return;
if(_currentView == NO_CURRENT_VIEW)
{ {
_currentView = _tail; _currentView = _tail;
} }
@ -332,7 +336,7 @@ void ScreenManager::displayPreviousView()
_currentView = _currentView->previous; _currentView = _currentView->previous;
} }
//End of the views, we cycle again :) //End of the views, we cycle again :)
else if(isListEmpty(_currentView->previous) && !isListEmpty(_tail)) else if(isListEmpty(_currentView->previous))
{ {
_currentView = _tail; _currentView = _tail;
} }