diff --git a/Code/Mantid/Framework/API/src/Sample.cpp b/Code/Mantid/Framework/API/src/Sample.cpp
index 753e68c6118bf8aa32d52b33be0bb8a552638af6..33950d0204522f33ae26fd8ebcd3a4ea4d908912 100644
--- a/Code/Mantid/Framework/API/src/Sample.cpp
+++ b/Code/Mantid/Framework/API/src/Sample.cpp
@@ -276,7 +276,7 @@ namespace Mantid
       {
         return *this;
       }
-      else if ((index > m_samples.size()) || ( index < 0))
+      else if ((static_cast<std::size_t>(index) > m_samples.size()) || ( index < 0))
       {
         throw std::out_of_range("The index value provided was out of range");
       }