From bc644d131c7628e43ffa2b2fe00ee38f74737b37 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 1 Sep 2018 10:45:03 +0200 Subject: [PATCH] Fix potential null pointer detected by Coverity --- src/insets/InsetInfo.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index 54b8cf090e..e712a7564d 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -182,11 +182,14 @@ docstring InsetInfoParams::getDate(string const iname, QDate const date) const else if (iname == "ISO") return qstring_to_ucs4(date.toString(Qt::ISODate)); else if (iname == "loclong") - return qstring_to_ucs4(loc.toString(date, toqstr(lang->dateFormat(0)))); + return lang ? qstring_to_ucs4(loc.toString(date, toqstr(lang->dateFormat(0)))) + : _("No long date format (language unknown)!"); else if (iname == "locmedium") - return qstring_to_ucs4(loc.toString(date, toqstr(lang->dateFormat(1)))); + return lang ? qstring_to_ucs4(loc.toString(date, toqstr(lang->dateFormat(1)))) + : _("No medium date format (language unknown)!"); else if (iname == "locshort") - return qstring_to_ucs4(loc.toString(date, toqstr(lang->dateFormat(2)))); + return lang ? qstring_to_ucs4(loc.toString(date, toqstr(lang->dateFormat(2)))) + : _("No short date format (language unknown)!"); else return qstring_to_ucs4(loc.toString(date, toqstr(iname))); }