Checks for null before accessing node's parent.

Fixes #19