doshell: check name for NULL.

The name variable was being used without first checking if it was
NULL. This patch corrects that clang warning.