Skip to content

Fix segfaults on some systems due to polyvertex being NULL

Hanicef requested to merge Hanicef/SRB2:fix-segfault-polyvertex-null into next

This is a bizarre one: on some systems, the game could segfault randomly due to the game failing to set polyvertices on lines when they get rendered on OpenGL. I discovered this on my laptop when I was running a debug build just yesterday, where this bug triggered consistently on startup, but never seems to trigger at all on my desktop. For some reason, the polyvertices are not allocated and set properly on certain hardware, which can trigger segfaults down the line once the game starts to render the world on OpenGL.

The fix is to just fall back to vertices if the polyvertices are NULL, as they seem to contain the same value except that polyvertices are floating-point while vertices are fixed-point.

Merge request reports