Properly handle NULL entities in getSystemVar()

Actually fix it this time. ಠ_ಠ