chore(views): moved check to avoid an array index warning

Was #6555

Thanks to  @git001