summaryrefslogtreecommitdiff
path: root/modules/thekla_unwrap
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-01-03 12:36:47 +0100
committerGitHub <noreply@github.com>2018-01-03 12:36:47 +0100
commit5519481803dbcdff079a2a1dceca5047f991e2ed (patch)
tree21e351d3fb13a3dbb2dc9a05d62f60337517e4d0 /modules/thekla_unwrap
parent8cf9269cdb614cd6601f9154ef0d6264e86a20c0 (diff)
parentc0226d2e92fb0125921b59bb2c226623ee454bef (diff)
Merge pull request #15114 from capnm/fix-bad-lightmap-crash
Avoid thekla_unwrap crash
Diffstat (limited to 'modules/thekla_unwrap')
-rw-r--r--modules/thekla_unwrap/register_types.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/thekla_unwrap/register_types.cpp b/modules/thekla_unwrap/register_types.cpp
index 2dc9217e48..eb11325dde 100644
--- a/modules/thekla_unwrap/register_types.cpp
+++ b/modules/thekla_unwrap/register_types.cpp
@@ -28,7 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
+#include "error_macros.h"
#include "thirdparty/thekla_atlas/thekla/thekla_atlas.h"
+
#include <stdio.h>
#include <stdlib.h>
extern bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y);
@@ -74,6 +76,11 @@ bool thekla_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_ver
delete[] input_mesh.face_array;
delete[] input_mesh.vertex_array;
+ if (output == NULL) {
+ ERR_PRINT("could not generate atlas output mesh");
+ return false;
+ }
+
if (err != Thekla::Atlas_Error_Success) {
printf("error with atlas\n");
} else {