ref: cc92d31eeaa40ae966196cfa5402474ffda0bbc7
parent: a91a40f18eb3a353025b21bf22599c30f65a1cd3
author: Simon Howard <[email protected]>
date: Fri Oct 9 21:02:58 EDT 2009
Don't crash when using the donut special type and the joining linedef is one sided (thanks Alexander Waldmann). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1711
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -1199,6 +1199,24 @@
rtn = 1;
s2 = getNextSector(s1->lines[0],s1);
+
+ // Vanilla Doom does not check if the linedef is one sided. The
+ // game does not crash, but reads invalid memory and causes the
+ // sector floor to move "down" to some unknown height.
+ // DOSbox prints a warning about an invalid memory access.
+ //
+ // I'm not sure exactly what invalid memory is being read. This
+ // isn't something that should be done, anyway.
+ // Just print a warning and return.
+
+ if (s2 == NULL)
+ {
+ fprintf(stderr,
+ "EV_DoDonut: linedef had no second sidedef! "
+ "Unexpected behavior may occur in Vanilla Doom. \n");
+ break;
+ }
+
for (i = 0;i < s2->linecount;i++)
{
if ((!s2->lines[i]->flags & ML_TWOSIDED) ||