mojoshader.c
changeset 1111 7530b37979b8
parent 1109 51292bd4476b
child 1115 ce5fbd601bc0
--- a/mojoshader.c	Thu Jun 07 04:31:01 2012 -0400
+++ b/mojoshader.c	Fri Aug 03 13:39:36 2012 -0400
@@ -7008,11 +7008,14 @@
     else
     {
         ConstantsList *item = alloc_constant_listitem(ctx);
-        item->constant.index = regnum;
-        item->constant.type = MOJOSHADER_UNIFORM_FLOAT;
-        memcpy(item->constant.value.f, ctx->dwords,
-               sizeof (item->constant.value.f));
-        set_defined_register(ctx, regtype, regnum);
+        if (item != NULL)
+        {
+            item->constant.index = regnum;
+            item->constant.type = MOJOSHADER_UNIFORM_FLOAT;
+            memcpy(item->constant.value.f, ctx->dwords,
+                   sizeof (item->constant.value.f));
+            set_defined_register(ctx, regtype, regnum);
+        } // if
     } // else
 } // state_DEF
 
@@ -7030,12 +7033,15 @@
     else
     {
         ConstantsList *item = alloc_constant_listitem(ctx);
-        item->constant.index = regnum;
-        item->constant.type = MOJOSHADER_UNIFORM_INT;
-        memcpy(item->constant.value.i, ctx->dwords,
-               sizeof (item->constant.value.i));
-
-        set_defined_register(ctx, regtype, regnum);
+        if (item != NULL)
+        {
+            item->constant.index = regnum;
+            item->constant.type = MOJOSHADER_UNIFORM_INT;
+            memcpy(item->constant.value.i, ctx->dwords,
+                   sizeof (item->constant.value.i));
+
+            set_defined_register(ctx, regtype, regnum);
+        } // if
     } // else
 } // state_DEFI
 
@@ -7053,10 +7059,13 @@
     else
     {
         ConstantsList *item = alloc_constant_listitem(ctx);
-        item->constant.index = regnum;
-        item->constant.type = MOJOSHADER_UNIFORM_BOOL;
-        item->constant.value.b = ctx->dwords[0] ? 1 : 0;
-        set_defined_register(ctx, regtype, regnum);
+        if (item != NULL)
+        {
+            item->constant.index = regnum;
+            item->constant.type = MOJOSHADER_UNIFORM_BOOL;
+            item->constant.value.b = ctx->dwords[0] ? 1 : 0;
+            set_defined_register(ctx, regtype, regnum);
+        } // if
     } // else
 } // state_DEFB