[Bf-blender-cvs] [19539c5] master: Cycles: Avoid crash when accessing non-existing volume attribute
Sergey Sharybin
noreply at git.blender.org
Tue Apr 12 13:26:23 CEST 2016
Commit: 19539c50c9481bd3b9436f8e1c5c753ae7d4ccee
Author: Sergey Sharybin
Date: Tue Apr 12 13:02:05 2016 +0200
Branches: master
https://developer.blender.org/rB19539c50c9481bd3b9436f8e1c5c753ae7d4ccee
Cycles: Avoid crash when accessing non-existing volume attribute
===================================================================
M intern/cycles/blender/blender_session.cpp
===================================================================
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 3e7fba0..aac2ffb 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -1077,8 +1077,8 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
{
/* empty image */
is_float = false;
- width = 0;
- height = 0;
+ width = 1;
+ height = 1;
depth = 0;
channels = 0;
@@ -1105,6 +1105,10 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
BL::Object b_ob(b_id);
BL::SmokeDomainSettings b_domain = object_smoke_domain_find(b_ob);
+ is_float = true;
+ depth = 1;
+ channels = 1;
+
if(!b_domain)
return;
@@ -1122,8 +1126,6 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
width = resolution.x * amplify;
height = resolution.y * amplify;
depth = resolution.z * amplify;
-
- is_float = true;
}
else {
/* TODO(sergey): Check we're indeed in shader node tree. */
@@ -1276,6 +1278,11 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
return true;
}
}
+ else {
+ fprintf(stderr, "Cycles error: unknown volume attribute, skipping\n");
+ pixels[0] = 0.0f;
+ return false;
+ }
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
}
More information about the Bf-blender-cvs
mailing list