From ca514ad91ef287b78a04f24a0f01c75a41aefeb0 Mon Sep 17 00:00:00 2001 From: Egor Pugin Date: Tue, 5 Jan 2021 15:37:43 +0300 Subject: [PATCH] [test] Return early on error. --- src/training/pango/pango_font_info.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/training/pango/pango_font_info.cpp b/src/training/pango/pango_font_info.cpp index 7cf1f696..86771b58 100644 --- a/src/training/pango/pango_font_info.cpp +++ b/src/training/pango/pango_font_info.cpp @@ -317,6 +317,8 @@ bool PangoFontInfo::GetSpacingProperties(const std::string& utf8_char, int* x_bearing, int* x_advance) const { // Convert to equivalent PangoFont structure PangoFont* font = ToPangoFont(); + if (!font) + return false; // Find the glyph index in the font for the supplied utf8 character. int total_advance = 0; int min_bearing = 0;