Correctly throw error instead of NPE if topic is empty. Change-Id: I0d7291bdd1dec690077026ee1498272f154a8b90