2c5ef58b8b
This commit fixes the crash, but it seems that the sorting doesn't work correctly with or without any vertices assigned.