fix potential null dereference.
fix potential null dereference.

Found by LLVM/Clang Static Analyzer.

initial patch from me, rewritten by jsing@

ok jsg@

orumin/openbsd-efivars,orumin/openbsd-efivars,orumin/openbsd-efivars,orumin/openbsd-efivars