# HG changeset patch # User paulb # Date 1191281220 0 # Node ID 20d44607697b38b65ef0da543427c42d7dcb3c5b # Parent 35c2b7e260c9223f673c10a52190d6058d26dcbc [project @ 2007-10-01 23:27:00 by paulb] Added safety checks for nodes. diff -r 35c2b7e260c9 -r 20d44607697b libxml2dom/macrolib/macrolib.py --- a/libxml2dom/macrolib/macrolib.py Mon Oct 01 23:26:37 2007 +0000 +++ b/libxml2dom/macrolib/macrolib.py Mon Oct 01 23:27:00 2007 +0000 @@ -258,19 +258,19 @@ return to_unicode(libxml2mod.name(node)) def Node_parentNode(node): - if libxml2mod.type(node) == "document_xml": + if node is None or libxml2mod.type(node) == "document_xml": return None else: return libxml2mod.parent(node) def Node_previousSibling(node): - if libxml2mod.prev(node) is not None: + if node is not None and libxml2mod.prev(node) is not None: return libxml2mod.prev(node) else: return None def Node_nextSibling(node): - if libxml2mod.next(node) is not None: + if node is not None and libxml2mod.next(node) is not None: return libxml2mod.next(node) else: return None