The broker tries to look for a named appid before the registration actua...

...lly occurs, which causes

a null exception. Adding a quick check for null/empty string to ensure this doesn't happen.