Null pointer exception fix for #34

In #34 the resource node was being checked for being null, the the TreePath wasn't. When the TreePath was null, getLastPathComponent() was trying to get the last node of a null TreePath and triggering the NPE.

This commit assigns a variable to the TreePath which is checked for being null before a resource node is gotten from it and checked for being null.