Add check for internal data in attach internal node function.

Since internal data is a pointer and isn't guaranteed we should check that it
exists before dereferencing it.
Merge pull request #161 from RickEyre/issue-80

Add check for internal data in attach internal node function.