tools+security: Add empty pointer checking in ndnsec-cert-gen

Change-Id: I096fea55fe05b01840d9bb718d0bab61e56cd3cd