summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-28 13:29:57 -0600
committerBrian <brian@yutani.localnet.net>2007-03-28 13:29:57 -0600
commitb463d521432c675c6336fde8b39870717e099be5 (patch)
tree3ef607e4df18d10226d215f8961365d2a39b122b /src/mesa/shader
parent7e4a7fdddd0b333d6825ac0154affeb520c5f0fe (diff)
added some null ptr checks to handle error recovery
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/slang/slang_emit.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index eeaeab1626..dd71933765 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -508,8 +508,13 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
/* normal case */
/* gen code for children */
- for (i = 0; i < info->NumParams; i++)
+ for (i = 0; i < info->NumParams; i++) {
emit(emitInfo, n->Children[i]);
+ if (!n->Children[i] || !n->Children[i]->Store) {
+ /* error recovery */
+ return NULL;
+ }
+ }
/* gen this instruction and src registers */
inst = new_instruction(emitInfo, info->InstOpcode);
@@ -997,6 +1002,11 @@ emit_cond(slang_emit_info *emitInfo, slang_ir_node *n)
/* emit code for the expression */
inst = emit(emitInfo, n->Children[0]);
+ if (!n->Children[0]->Store) {
+ /* error recovery */
+ return NULL;
+ }
+
assert(n->Children[0]->Store);
/*assert(n->Children[0]->Store->Size == 1);*/
@@ -1074,7 +1084,10 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n)
inst = emit(emitInfo, n->Children[0]); /* the condition */
if (emitInfo->EmitCondCodes) {
- assert(inst);
+ if (!inst) {
+ /* error recovery */
+ return NULL;
+ }
condWritemask = inst->DstReg.WriteMask;
}