# HG changeset patch # User Wuzzy # Date 1508605373 -7200 # Node ID 2b0a4a4b1ba27665d6378a8bba780c0175ffa2d2 # Parent 2c4a07eb211217c99711455cb095c49b99a23ab4 Fix division by 0 in sniper rifle training diff -r 2c4a07eb2112 -r 2b0a4a4b1ba2 share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua --- a/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua Sat Oct 21 18:52:24 2017 +0200 +++ b/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua Sat Oct 21 19:02:53 2017 +0200 @@ -395,7 +395,10 @@ -- This function calculates the final score of the player and provides some texts and -- data for the final stats screen function generateStats() - local accuracy = (score/shots)*100 + local accuracy = 0 + if shots > 0 then + accuracy = (score/shots)*100 + end local end_score_targets = (score_bonus * 200) local end_score_overall if not game_lost then