diff --git a/modules/gui/src/python_shell/shell_history.cc b/modules/gui/src/python_shell/shell_history.cc
index 14ce28eaf96eebc4e8a61659daebc0c5b7e1d93b..01d7e16c329f38b5db15155478f7304e0f9eafa9 100644
--- a/modules/gui/src/python_shell/shell_history.cc
+++ b/modules/gui/src/python_shell/shell_history.cc
@@ -91,14 +91,14 @@ void ShellHistory::MoveToPreviousMatch()
 void ShellHistory::MoveToNextMatch()
 {
   int newindex=index_+1;
-  while(newindex<history_list_.size()){
+  while(static_cast<unsigned int>(newindex)<history_list_.size()){
     if(history_list_[newindex].first.indexOf(current_)==0 || current_.size()==0){
       index_=newindex;
       break;
     }
     ++newindex;
   }
-  if(newindex!=index_){
+  if(static_cast<unsigned int>(newindex)!=index_){
     index_=history_list_.size();
   }
 }