From 037faebaf43e414b9244cbbab9b4c07e464594a0 Mon Sep 17 00:00:00 2001
From: Xiang Li <xlxiangli@tencent.com>
Date: Thu, 4 Apr 2019 18:00:30 -0700
Subject: [PATCH] Fix encoding crash in JVET-N0329

---
 source/Lib/CommonLib/IbcHashMap.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/source/Lib/CommonLib/IbcHashMap.cpp b/source/Lib/CommonLib/IbcHashMap.cpp
index 0b2cce6ef..57940cbf7 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
 //! \}
-- 
GitLab