Handle out of memory error better.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 03 Feb 2009 17:16:56 -0500
changeset 549 13714d3b3fa2
parent 548 b37cdacb50d5
child 550 2f977a75d2b5
Handle out of memory error better.
mojoshader_assembler.c
--- a/mojoshader_assembler.c	Tue Feb 03 17:16:32 2009 -0500
+++ b/mojoshader_assembler.c	Tue Feb 03 17:16:56 2009 -0500
@@ -1779,10 +1779,12 @@
 
 static const MOJOSHADER_parseData *build_failed_assembly(Context *ctx)
 {
+    assert(isfail(ctx));
+
+    if (ctx->out_of_memory)
+        return &out_of_mem_data;
+        
     MOJOSHADER_parseData *retval = NULL;
-    if (!isfail(ctx))
-        return NULL;
-
     retval = (MOJOSHADER_parseData*) Malloc(ctx, sizeof(MOJOSHADER_parseData));
     if (retval == NULL)
         return &out_of_mem_data;