foxygit / doom Log in
commit 52c49e45fb8da3dc0fa7c9d26d34c39b4a7cbc71
Author:     mfrancis95 <mikefrancis95@gmail.com>
AuthorDate: Tue Jan 1 03:18:03 2019 -0500
Commit:     mfrancis95 <mikefrancis95@gmail.com>
CommitDate: Tue Jan 1 03:18:03 2019 -0500

    Apply @fabiangreffrath's patch to fix a memory error in Hexen
---
 src/hexen/sc_man.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/hexen/sc_man.c b/src/hexen/sc_man.c
index 3778fd97..1ebd1700 100644
--- a/src/hexen/sc_man.c
+++ b/src/hexen/sc_man.c
@@ -197,16 +197,16 @@ boolean SC_GetString(void)
     {
         while (*ScriptPtr <= 32)
         {
-            if (ScriptPtr >= ScriptEndPtr)
-            {
-                sc_End = true;
-                return false;
-            }
             if (*ScriptPtr++ == '\n')
             {
                 sc_Line++;
                 sc_Crossed = true;
             }
+            if (ScriptPtr >= ScriptEndPtr)
+            {
+                sc_End = true;
+                return false;
+            }
         }
         if (ScriptPtr >= ScriptEndPtr)
         {