Fix a bug that the number of indexes isn't correct if index buffer is NULL