Don't crash in certain instances when the current node has changed
This will happen e.g. when deleting a filter mask which is currently
selected, and we'll end up with a potentially dangling pointer. The
code should be doing it this way anyway, so... yeah, sorted :)