consistently protect against NULL pointer dereference

found by cppcheck
remove result after cppcheck noticed that it isn't used later