From 2d5ade298b5fed3d6acf8edfdeb421d1e80097b9 Mon Sep 17 00:00:00 2001 From: Anthony Garcia Date: Sun, 1 Mar 2015 13:05:42 -0700 Subject: [PATCH] Handle missing attr defs gracefully --- steam/items.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/steam/items.py b/steam/items.py index d25122e..6b0dfc0 100644 --- a/steam/items.py +++ b/steam/items.py @@ -652,7 +652,8 @@ def __init__(self, item, schema=None): if schema: attrdef = schema._attribute_definition(index) - index = attrdef["defindex"] + if attrdef: + index = attrdef["defindex"] self._attributes.setdefault(index, {}) @@ -666,7 +667,10 @@ def __init__(self, item, schema=None): index = attr["defindex"] if schema and index not in self._attributes: - self._attributes[index] = schema._attribute_definition(index) + attrdef = schema._attribute_definition(index) + + if attrdef: + self._attributes[index] = attrdef self._attributes.setdefault(index, {}) self._attributes[index].update(attr)