diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-03-22 18:17:06 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-03-22 18:17:06 +0100 |
commit | 92344ee3f306ecdfd1da4365ffc5cab6eaa29afd (patch) | |
tree | 257975a76c4b24d0cf5f0e85134b9c362e5afceb /src | |
parent | c17c9486a22ce9f2160b2d2ad559d9a19e453f83 (diff) |
Fix a wrap-around in skills menu
The previous implementation would result in undefined behavior
when wrapping around 0.
Diffstat (limited to 'src')
-rw-r--r-- | src/skills.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/skills.cc b/src/skills.cc index 87aebd9c..787cbfa5 100644 --- a/src/skills.cc +++ b/src/skills.cc @@ -554,7 +554,7 @@ void do_cmd_skill() if (dir == 8) sel--; /* Miscellaneous skills cannot be increased/decreased as a group */ - if (table[sel][0] == SKILL_MISC) continue; + if ((sel >= 0) && (sel < max) && table[sel][0] == SKILL_MISC) continue; /* Increase the current skill */ if (dir == 6) increase_skill(table[sel][0], skill_invest.get()); |