fix to nullpointer exception

This is a fix to an unusual NullPointerException that occurs during drag and drop
Merge pull request #132 from g-pechorin/patch-1

fix to nullpointer exception