From c8bab6d1c6c36c67a5c354fb719474542f4f80b5 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 7 Nov 2009 06:39:14 -0500 Subject: Throw an error if UTF-8 encoding is incorrect --- src/commodity.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/commodity.cc b/src/commodity.cc index a0827e7a..0d6c11c6 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -512,7 +512,7 @@ void commodity_t::parse_symbol(std::istream& in, string& symbol) for (std::size_t i = 0; i < bytes; i++) { in.get(c); if (in.bad() || in.eof()) - break; + throw_(amount_error, _("Invalid UTF-8 encoding for commodity name")); *_p++ = c; } } @@ -526,7 +526,7 @@ void commodity_t::parse_symbol(std::istream& in, string& symbol) if (c == '\\') { in.get(c); if (in.eof()) - break; + throw_(amount_error, _("Backslash at end of commodity name")); } *_p++ = c; } -- cgit v1.2.3