[Bf-blender-cvs] [d35bf3f] master: Fix compile error when building without smoke support.

Kévin Dietrich noreply at git.blender.org
Sun Sep 25 00:26:32 CEST 2016


Commit: d35bf3f421fe4166f5275067cc71e92465f1b954
Author: Kévin Dietrich
Date:   Sun Sep 25 00:26:21 2016 +0200
Branches: master
https://developer.blender.org/rBd35bf3f421fe4166f5275067cc71e92465f1b954

Fix compile error when building without smoke support.

Also fixes possible NULL pointer dereference.

Fixes T49445.

===================================================================

M	source/blender/editors/space_view3d/drawvolume.c

===================================================================

diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index ef4db7e..79d5109 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -648,6 +648,20 @@ typedef void (*vector_draw_func)(float(*)[3], float(*)[3], float*, float*, float
 
 void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3])
 {
+#ifdef WITH_SMOKE
+	const float *vel_x = smoke_get_velocity_x(domain->fluid);
+	const float *vel_y = smoke_get_velocity_y(domain->fluid);
+	const float *vel_z = smoke_get_velocity_z(domain->fluid);
+#else
+	const float *vel_x = NULL;
+	const float *vel_y = NULL;
+	const float *vel_z = NULL;
+#endif
+
+	if (ELEM(NULL, vel_x, vel_y, vel_z)) {
+		return;
+	}
+
 	const int *base_res = domain->base_res;
 	const int *res = domain->res;
 	const int *res_min = domain->res_min;
@@ -655,10 +669,6 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3])
 	int res_max[3];
 	copy_v3_v3_int(res_max, domain->res_max);
 
-	const float *vel_x = smoke_get_velocity_x(domain->fluid);
-	const float *vel_y = smoke_get_velocity_y(domain->fluid);
-	const float *vel_z = smoke_get_velocity_z(domain->fluid);
-
 	const float *cell_size = domain->cell_size;
 	const float step_size = ((float)max_iii(base_res[0], base_res[1], base_res[2])) / 16.0f;




More information about the Bf-blender-cvs mailing list