Fixed NPE when there's no topic/subscription.

Change-Id: I0ef23245b42c0df52d9fd741c6b8ee6d8f16c447