diff --git a/source/Lib/CommonLib/IbcHashMap.cpp b/source/Lib/CommonLib/IbcHashMap.cpp
index 0b2cce6eff63aa64738129f3a9bb568e601bfab8..57940cbf7e2061e448d0dd968a7758fbd224c5a0 100644
--- a/source/Lib/CommonLib/IbcHashMap.cpp
+++ b/source/Lib/CommonLib/IbcHashMap.cpp
@@ -446,7 +446,15 @@ int IbcHashMap::calHashBlkMatchPerc(const Area& lumaArea)
       total++;
     }
   }
-  return 100 * hit / total;
+
+  if (total == 0)
+  {
+    return 0;
+  }
+  else
+  {
+    return 100 * hit / total;
+  }
 }
 #endif
 //! \}