Skip to content

Commit

Permalink
Handle divide by zero issue
Browse files Browse the repository at this point in the history
  • Loading branch information
U-lis committed Jul 18, 2024
1 parent 2af04ae commit 1397da1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Lib9c/Helper/AdventureBossHelper.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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 _))
Expand Down

0 comments on commit 1397da1

Please sign in to comment.