Fixed nullptr and array out of bounds.