Check for node is null, before node.parentNode

Checks that the 'node' variable passed to getParent() function isn't null.