remove unused variable (coverity 1091341)
avoid NULL pointer dereference (coverity 1091332)