From 1397da12f318b8c0b40e8515c05ce8b35ffd63c0 Mon Sep 17 00:00:00 2001 From: hyeon Date: Thu, 18 Jul 2024 10:53:22 +0900 Subject: [PATCH] Handle divide by zero issue --- Lib9c/Helper/AdventureBossHelper.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib9c/Helper/AdventureBossHelper.cs b/Lib9c/Helper/AdventureBossHelper.cs index c8eed37776..941d08de25 100644 --- a/Lib9c/Helper/AdventureBossHelper.cs +++ b/Lib9c/Helper/AdventureBossHelper.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.Globalization; using System.Linq; using Nekoyume.Module; using Lib9c; @@ -283,8 +282,9 @@ public static AdventureBossGameData.ClaimableReward CalculateExploreReward( // calculate ncg reward var totalNcgReward = (bountyBoard.totalBounty() * 15).DivRem(100, out _); - var myNcgReward = (totalNcgReward * explorer.Score) - .DivRem(exploreBoard.TotalPoint, out _); + var myNcgReward = exploreBoard.TotalPoint == 0 + ? 0 * totalNcgReward.Currency + : (totalNcgReward * explorer.Score).DivRem(exploreBoard.TotalPoint, out _); // Only > 0.1 NCG will be rewarded. if (myNcgReward >= (10 * gold).DivRem(100, out _))