Prevents NSRangeException

Fixes #2664

This crash was caused by invalid backend data (still a pending issue). Nevertheless, i'm adding code so the client doesn't break violently.

/cc @diegoreymendez