Merge pull request #257 from Carton/1.7

fix ValueError when converting empty string KM to float in sgf parser
This commit is contained in:
sanderland authored and GitHub committed 2020-12-07 06:46:48 +09:00
commit fbefcdbb7f
1 file changed
+6 -1
+6 -1
View File
@@ -192,7 +192,12 @@ class SGFNode:
@property
def komi(self) -> float:
"""Retrieves the root's KM property, or 6.5 if missing"""
return float(self.root.get_property("KM", 6.5))
try:
km = float(self.root.get_property("KM", 6.5))
except ValueError:
km = 6.5
return km
@property
def ruleset(self) -> str: