diff --git a/include/Win_GParted.h b/include/Win_GParted.h
index 9326c51..0e14a26 100644
--- a/include/Win_GParted.h
+++ b/include/Win_GParted.h
@@ -60,7 +60,7 @@ private:
 	void Fill_Label_Device_Info( bool clear = false );
 
 	void Add_Operation( Operation * operation, int index = -1 ) ;
-	bool Merge_Operations( int first, int second );
+	bool Merge_Operations( unsigned int first, unsigned int second );
 	void Refresh_Visual();
 	bool Quit_Check_Operations();
 	void set_valid_operations() ;
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 4ad1243..7320c71 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -720,8 +720,11 @@ void Win_GParted::Add_Operation( Operation * operation, int index )
 	}
 }
 
-bool Win_GParted::Merge_Operations( int first, int second )
+bool Win_GParted::Merge_Operations( unsigned int first, unsigned int second )
 {
+    if( first >= operations .size() || second >= operations .size() )
+        return false;
+
 	// Two resize operations of the same partition
 	if ( operations[ first ]->type == OPERATION_RESIZE_MOVE &&
 	     operations[ second ]->type == OPERATION_RESIZE_MOVE &&
@@ -766,7 +769,7 @@ bool Win_GParted::Merge_Operations( int first, int second )
 	else if ( operations[ first ]->type == OPERATION_FORMAT &&
 	          operations[ second ]->type == OPERATION_FORMAT &&
 	          operations[ first ]->partition_new == operations[ second ]->partition_original
-	   )
+	        )
 	{
 		operations[ first ]->partition_new = operations[ second ]->partition_new;
 		operations[ first ]->create_description() ;
