From: David Griffith Date: Wed, 19 Jan 2022 07:48:32 +0000 (-0800) Subject: Added some guards against setting an invalid NKI. It just happened! X-Git-Tag: r8~1 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=bc7eeadf9bf1b1e6e6652d264aff75ab0ddff0b9;p=rfk-inform.git Added some guards against setting an invalid NKI. It just happened! The default reply from lookup_msg() is "Unknown NKI (this should not happen)" If that does happen, it means that a number less than 1 or greater than MESSAGE_NUM was given. There may be something wacky going on with Inform's random() function. --- diff --git a/kitten.inf b/kitten.inf index e99fd21..d756519 100644 --- a/kitten.inf +++ b/kitten.inf @@ -819,7 +819,7 @@ Global last_right = false; [ get_random_msg num; num = random(MESSAGE_NUM); - while (is_duplicate_msg(num) == true) { + while (is_duplicate_msg(num) == true || num > MESSAGE_NUM || num < 1) { num = random(MESSAGE_NUM); } return num;