Adding logic to prevent NPE in OSGi-based MasterApplicationFactory.

Signed-off-by: Jordan Deyton <jordan.deyton@gmail.com>