Fixes #2253, array contains null elements

As I suggested in issue #2253, there might be null elements in the array that is iterated over. By skipping over these elements, the server crash I reported no longer occurs.