Browse Source

Fix #4980

Add nullptr check.
Jeroen van Rijn 4 months ago
parent
commit
10bde20850
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/llvm_backend_const.cpp

+ 1 - 1
src/llvm_backend_const.cpp

@@ -33,7 +33,7 @@ gb_internal bool lb_is_elem_const(Ast *elem, Type *elem_type) {
 
 gb_internal bool lb_is_const_nil(lbValue value) {
 	LLVMValueRef v = value.value;
-	if (LLVMIsConstant(v)) {
+	if (v != nullptr && LLVMIsConstant(v)) {
 		if (LLVMIsAConstantAggregateZero(v)) {
 			return true;
 		} else if (LLVMIsAConstantPointerNull(v)) {