From 01f0eb84f8efb3728f8627c9c37176902bba8e0a Mon Sep 17 00:00:00 2001 From: Stefan Westerfeld Date: Wed, 20 Jul 2022 11:56:09 +0200 Subject: [PATCH] LIB: do not use std::vector operator[] on empty vector When compiled with -D_GLIBCXX_ASSERTIONS, this triggers an assertion. Possibly related to issues #27 and #34. Signed-off-by: Stefan Westerfeld --- lib/log.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/log.cc b/lib/log.cc index ddf43e3..2cfec13 100644 --- a/lib/log.cc +++ b/lib/log.cc @@ -19,7 +19,7 @@ string_printf (const char *format, ...) /* figure out required size */ va_start (ap, format); - int size = vsnprintf (&buffer[0], buffer.size(), format, ap); + int size = vsnprintf (nullptr, 0, format, ap); va_end (ap); if (size < 0)