Explorar o código

Fix for a possible NULL dereference issue.

Marco Bambini %!s(int64=7) %!d(string=hai) anos
pai
achega
51eb59d927
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/compiler/gravity_optimizer.c

+ 2 - 0
src/compiler/gravity_optimizer.c

@@ -259,6 +259,8 @@ inline static inst_t *current_instruction (ircode_t *code, uint32_t i) {
 // MARK: -
 
 static bool optimize_const_instruction (inst_t *inst, inst_t *inst1, inst_t *inst2) {
+    if (!inst2) return false;
+    
 	// select type algorithm:
 	// two numeric types are supported here, int64 or double
 	// if types are equals then set the first one