assert that u.ulevel is in range for use as index

Resolves #1189
This commit is contained in:
nhmall
2024-01-01 10:55:14 -05:00
parent 95aceb1722
commit 76179ea0ba

View File

@@ -240,6 +240,8 @@ losexp(
livelog_printf(LL_MINORAC, "lost all experience");
}
assert(u.ulevel >= 0 && u.ulevel < MAXULEV);
olduhpmax = u.uhpmax;
uhpmin = minuhpmax(10); /* same minimum as is used by life-saving */
num = (int) u.uhpinc[u.ulevel];