From 2313e583930bd0bd8eeec18afc8d72c4b8350093 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 6 Dec 2020 16:49:30 +0000 Subject: [PATCH] AK: Make Formatter not choke on Mode::Character Formatter internally uses Formatter when in Mode::Character, but that would only accept Mode::{Default,String} and ASSERT_NOT_REACHED() otherwise, causing String::formatted("{:c}", 'a') to crash --- AK/Format.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/Format.cpp b/AK/Format.cpp index 567d072154..7fa10d3268 100644 --- a/AK/Format.cpp +++ b/AK/Format.cpp @@ -522,7 +522,7 @@ void Formatter::format(TypeErasedFormatParams& params, FormatBuilder ASSERT_NOT_REACHED(); if (m_zero_pad) ASSERT_NOT_REACHED(); - if (m_mode != Mode::Default && m_mode != Mode::String) + if (m_mode != Mode::Default && m_mode != Mode::String && m_mode != Mode::Character) ASSERT_NOT_REACHED(); if (m_width != value_not_set && m_precision != value_not_set) ASSERT_NOT_REACHED();