From 61c0167ad797f8d6cd95624e0f45d93396c53bef Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 20 Aug 2019 11:23:09 -0500 Subject: [PATCH] Fix TTF iteration in case of an empty list. --- src/ttf.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ttf.cpp b/src/ttf.cpp index 4251767..ebf7cc5 100644 --- a/src/ttf.cpp +++ b/src/ttf.cpp @@ -72,13 +72,13 @@ void TtfFontList::LoadAll() { } // Sort fonts according to their actual name, not filename. - std::sort(&l[0], &l[l.n], + std::sort(l.begin(), l.end(), [](const TtfFont &a, const TtfFont &b) { return a.name < b.name; }); // Filter out fonts with the same family and style name. This is not // strictly necessarily the exact same font, but it will almost always be. - TtfFont *it = std::unique(&l[0], &l[l.n], - [](const TtfFont &a, const TtfFont &b) { return a.name == b.name; }); + TtfFont *it = std::unique(l.begin(), l.end(), + [](const TtfFont &a, const TtfFont &b) { return a.name == b.name; }); l.RemoveLast(&l[l.n] - it); //! @todo identify fonts by their name and not filename, which may change