X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=sst;h=79c5683065fc710013ea8aeca1cfff3532728fc7;hb=bce28a99cb6099d1dfe2cf5d482201c4696f820e;hp=beff5c9cf497a2bc9d9ac35577a9bc4981833590;hpb=5988f0d232e7d2a6721584193dc343ef9c802988;p=super-star-trek.git diff --git a/sst b/sst index beff5c9..79c5683 100755 --- a/sst +++ b/sst @@ -18,7 +18,7 @@ on how to modify (and how not to modify!) this code. # pylint: disable=multiple-imports import os, sys, math, curses, time, pickle, copy, gettext, getpass -import getopt, socket, locale, getpass +import getopt, socket, locale import codecs # This import only works on Unixes. The intention is to enable @@ -6653,14 +6653,14 @@ class sstscanner: s = Coord() self.nexttok() if (game.options & OPTION_ALPHAMERIC): - if (self.type == "IHALPHA") and (self.token[0] in "abcdefghij") and (self.token[1] in "0123456789"): - s.i = ord(self.token[0]) - ord("a") - try: - s.j = int(self.token[-1:])-1 - except TypeError: - huh() - return None - return s + try: + if (self.type == "IHALPHA") and (self.token[0] in "abcdefghij") and (self.token[1] in "0123456789"): + s.i = ord(self.token[0]) - ord("a") + s.j = int(self.token[1:])-1 + return s + except (TypeError, IndexError): + huh() + return None if self.type != "IHREAL": huh() return None