diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2016-09-25 01:26:21 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2016-09-25 01:26:21 +0300 |
commit | d35bf3f421fe4166f5275067cc71e92465f1b954 (patch) | |
tree | 41b4ac5c05894beec6effc5eea50f52d0ac513ff /source/blender/editors/space_view3d/drawvolume.c | |
parent | 14e825aa1fb57db85cecfda0cd69843b57cefd12 (diff) |
Fix compile error when building without smoke support.
Also fixes possible NULL pointer dereference.
Fixes T49445.
Diffstat (limited to 'source/blender/editors/space_view3d/drawvolume.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawvolume.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index ef4db7ed6b8..79d51093734 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; |