Doesn't that do the same as this?
Code:
if (inst == NULL) return;



Also, the problem persists with your solution.