From aaba3b3a5ef6e1ca7d3285dc324dffdb2722f1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Mon, 20 Jun 2022 04:39:25 -0700 Subject: [PATCH] Cleanup. --- examples/common/nanovg/nanovg_bgfx.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index 39009f517..fccee88db 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -764,12 +764,15 @@ namespace { int avail = bgfx::getAvailTransientVertexBuffer(gl->nverts, s_nvgLayout); if (avail < gl->nverts) - { + { gl->nverts = avail; BX_WARN(true, "Vertex number truncated due to transient vertex buffer overflow"); if (gl->nverts < 2) + { goto _cleanup; } + } + bgfx::allocTransientVertexBuffer(&gl->tvb, gl->nverts, s_nvgLayout); int allocated = gl->tvb.size/gl->tvb.stride; @@ -814,8 +817,8 @@ namespace } } +_cleanup: // Reset calls - _cleanup: gl->nverts = 0; gl->npaths = 0; gl->ncalls = 0;