parse_file: fix "decoded" may not be initialized issue

if "encoding" parameter not None.
This commit is contained in:
Carton He committed 2020-12-23 00:19:19 +08:00
1 parent 7b28a8d7e4
commit fe726d2ee3
1 file changed
+4 -4
+4 -4
View File
@@ -384,10 +384,10 @@ class SGF:
encoding = match[1].decode("ascii", errors="ignore")
else:
encoding = cls.DEFAULT_ENCODING
try:
decoded = bin_contents.decode(encoding=encoding, errors="ignore")
except LookupError:
decoded = bin_contents.decode(encoding=cls.DEFAULT_ENCODING, errors="ignore")
try:
decoded = bin_contents.decode(encoding=encoding, errors="ignore")
except LookupError:
decoded = bin_contents.decode(encoding=cls.DEFAULT_ENCODING, errors="ignore")
if is_ngf:
return cls.parse_ngf(decoded)
if is_gib: