Fix division by 0 in sniper rifle training
authorWuzzy <Wuzzy2@mail.ru>
Sat, 21 Oct 2017 19:02:53 +0200
changeset 12731 2b0a4a4b1ba2
parent 12730 2c4a07eb2112
child 12732 e7ed1b91c68b
Fix division by 0 in sniper rifle training
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