mojoshader_assembler.c
changeset 544 f829f48e5214
parent 543 98742b1d8a4a
child 548 b37cdacb50d5
--- a/mojoshader_assembler.c	Tue Feb 03 08:59:38 2009 -0500
+++ b/mojoshader_assembler.c	Tue Feb 03 09:03:25 2009 -0500
@@ -145,19 +145,20 @@
         error->error.error = failstr;
         error->error.filename = fname ? StrDup(ctx, fname) : NULL;
         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