From: Wolfgang Bumiller Date: Thu, 27 Dec 2012 13:43:31 +0000 (+0100) Subject: fix segfault from previous cherry-pick X-Git-Tag: 0.2.2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e26d1e985a5f8c25544f23f9dfbe0295e6bb4c37;p=xonotic%2Fgmqcc.git fix segfault from previous cherry-pick --- diff --git a/ir.c b/ir.c index f7bc052..49f196e 100644 --- a/ir.c +++ b/ir.c @@ -1021,16 +1021,22 @@ ir_value* ir_value_vector_member(ir_value *self, unsigned int member) if (self->members[member]) return self->members[member]; - len = strlen(self->name); - name = (char*)mem_a(len + 3); - memcpy(name, self->name, len); - name[len+0] = '_'; - name[len+1] = 'x' + member; - name[len+2] = '\0'; + if (self->name) { + len = strlen(self->name); + name = (char*)mem_a(len + 3); + memcpy(name, self->name, len); + name[len+0] = '_'; + name[len+1] = 'x' + member; + name[len+2] = '\0'; + } + else + name = NULL; + if (self->vtype == TYPE_VECTOR) { m = ir_value_var(name, self->store, TYPE_FLOAT); - mem_d(name); + if (name) + mem_d(name); if (!m) return NULL; m->context = self->context; @@ -1043,7 +1049,8 @@ ir_value* ir_value_vector_member(ir_value *self, unsigned int member) if (self->fieldtype != TYPE_VECTOR) return NULL; m = ir_value_var(name, self->store, TYPE_FIELD); - mem_d(name); + if (name) + mem_d(name); if (!m) return NULL; m->fieldtype = TYPE_FLOAT;