Minor code optimization in _compute_topic

In cases where a valid host is passed, the if
statement is always executed twice, not once like it should

Change-Id: I6a24bb4f85bfb94d2fdc5d1652ee371f296a10ef
Merge "Minor code optimization in _compute_topic"