Don't crash when a reference is clicked

Change-Id: I9f28f8b0be702503579d4a97ce22cff30d21f7cd