From e2d8c03e1aed4ce4da98039922ad446a55600e9c Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 13 Jan 2015 23:06:55 +0000 Subject: [PATCH] Fixed ImGuiTextBuffer::empty() to ignore the enforced zero-terminator + removed unnecessary destructor --- imgui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.h b/imgui.h index 9248ae44..dc009ccc 100644 --- a/imgui.h +++ b/imgui.h @@ -604,11 +604,11 @@ struct ImGuiTextBuffer ImVector Buf; ImGuiTextBuffer() { Buf.push_back(0); } - ~ImGuiTextBuffer() { clear(); } + ~ImGuiTextBuffer() { } const char* begin() const { return &Buf.front(); } const char* end() const { return &Buf.back(); } // Buf is zero-terminated, so end() will point on the zero-terminator size_t size() const { return Buf.size()-1; } - bool empty() { return Buf.empty(); } + bool empty() { return size() >= 1; } void clear() { Buf.clear(); Buf.push_back(0); } IMGUI_API void append(const char* fmt, ...); IMGUI_API void appendv(const char* fmt, va_list args);