Check a pointer before using it

Signed-off-by: Michael Leibowitz <michael.leibowitz@intel.com>