mojoshader.c
changeset 544 f829f48e5214
parent 542 a56d3bfd2e36
child 545 6fa65cddbaad
--- a/mojoshader.c	Tue Feb 03 08:59:38 2009 -0500
+++ b/mojoshader.c	Tue Feb 03 09:03:25 2009 -0500
@@ -396,19 +396,20 @@
         error->error.error = failstr;
         error->error.filename = NULL;  // no filename at this level.
         error->error.error_position = error_position;
+        error->next = NULL;
 
         ErrorList *prev = NULL;
-        error->next = ctx->errors;
-        while (error->next != NULL)
+        ErrorList *item = ctx->errors;
+        while (item != NULL)
         {
-            prev = error->next;
-            error->next = error->next->next;
+            prev = item;
+            item = error->next;
         } // while
 
-        if (prev != NULL)
+        if (prev == NULL)
+            ctx->errors = error;
+        else
             prev->next = error;
-        else
-            ctx->errors = error;
 
         ctx->error_count++;
     } // else