From 6c6a550fd6e28a15f300bcf6c16115470b8daff4 Mon Sep 17 00:00:00 2001 From: Miha Lunar Date: Fri, 21 Nov 2014 00:39:04 +0100 Subject: [PATCH] Fix for convexFill crash when path fillCount is 0 In our situation, the crash happened due to the view dimensions being reset to 0x0 after minimizing the window. This translated to fillCount of a path ending up at 0, which makes `fan` crash as it computes number of tris to -2 of fillCount. Since `numTris` is unsigned, this could lead to terrible things, but luckily it crashes soon. There might be a cleaner fix for this further up the call stack, but this is a good solution in the meanwhile. --- examples/common/nanovg/nanovg_bgfx.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index 15aaaa62..d697eafc 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -620,6 +620,7 @@ namespace for (i = 0; i < npaths; i++) { + if (paths[i].fillCount == 0) continue; bgfx::setProgram(gl->prog); bgfx::setState(gl->state); bgfx::setVertexBuffer(&gl->tvb);