Prevent a crash when there is no accessible interface

Change-Id: I058b76ff9d40b75eb51f9a6b1b89032ead629aed
Reviewed-by: Liang Qi <liang.qi@digia.com>