From f0334c3eecedcd366218f075522c1981690d91b5 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Sat, 1 Dec 2018 23:21:53 +0930 Subject: [PATCH] Fix crash on uvunwrapping #18 --- dust3d.pro | 4 ++-- thirdparty/simpleuv/simpleuv/parametrize.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dust3d.pro b/dust3d.pro index 064b3633..8aee27d3 100644 --- a/dust3d.pro +++ b/dust3d.pro @@ -4,10 +4,10 @@ DEFINES += NDEBUG RESOURCES += resources.qrc isEmpty(HUMAN_VERSION) { - HUMAN_VERSION = "1.0.0-beta.3" + HUMAN_VERSION = "1.0.0-beta.4" } isEmpty(VERSION) { - VERSION = 1.0.0.3 + VERSION = 1.0.0.4 } REPOSITORY_URL = "https://github.com/huxingyi/dust3d" diff --git a/thirdparty/simpleuv/simpleuv/parametrize.cpp b/thirdparty/simpleuv/simpleuv/parametrize.cpp index 2e01ac26..316fce48 100644 --- a/thirdparty/simpleuv/simpleuv/parametrize.cpp +++ b/thirdparty/simpleuv/simpleuv/parametrize.cpp @@ -55,6 +55,10 @@ bool extractResult(const std::vector &verticies, const Eigen::MatrixXd & return false; return true; }; + if ((decltype(verticies.size()))V_uv.size() < verticies.size() * 2) { + qDebug() << "Invalid V_uv.size:" << V_uv.size() << "Expected:" << verticies.size() * 2; + return false; + } for (decltype(verticies.size()) i = 0; i < verticies.size(); i++) { TextureCoord coord; coord.uv[0] = V_uv.row(i)[0];