summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/skills2.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-04-07 17:42:15 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-04-07 17:42:15 +0200
commitded251442c5f98b0b98f7567b04b773b70a70f6d (patch)
tree7574a0c57b5a9f86724501e32a458e74571e02e4 /crawl-ref/source/skills2.cc
parent211afdb1629cfef3b825e86bc604c6667b47b6d8 (diff)
downloadcrawl-ref-ded251442c5f98b0b98f7567b04b773b70a70f6d.tar.gz
crawl-ref-ded251442c5f98b0b98f7567b04b773b70a70f6d.zip
Fix a crash during startup.
For some weird reasons LTO only, and shows up only on Windows, even though it's in a platform independent part. The division by zero here is real.
Diffstat (limited to 'crawl-ref/source/skills2.cc')
-rw-r--r--crawl-ref/source/skills2.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index 36f544e6c6..41e2c98044 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -148,6 +148,8 @@ int get_skill_progress(skill_type sk, int level, int points, int scale)
const int needed = skill_exp_needed(level + 1, sk);
const int prev_needed = skill_exp_needed(level, sk);
+ if (needed == 0) // invalid race, letitimate at startup
+ return 0;
// A scale as small as 92 would overflow with 31 bits if skill_rdiv()
// is involved: needed can be 91985, skill_rdiv() multiplies by 256.
const int64_t amt_done = points - prev_needed;