Commit b4aece8a authored by Ell's avatar Ell

app: avoid CRITICAL when loading XCF with empty gimp-text-layer parasite

parent e97f2510
......@@ -33,10 +33,14 @@
#include "text-types.h"
#include "core/gimperror.h"
#include "gimptext.h"
#include "gimptext-parasite.h"
#include "gimptext-xlfd.h"
#include "gimp-intl.h"
/****************************************/
/* The native GimpTextLayer parasite. */
......@@ -80,15 +84,22 @@ gimp_text_from_parasite (const GimpParasite *parasite,
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
str = gimp_parasite_data (parasite);
g_return_val_if_fail (str != NULL, NULL);
text = g_object_new (GIMP_TYPE_TEXT, NULL);
if (str != NULL)
{
gimp_config_deserialize_string (GIMP_CONFIG (text),
str,
gimp_parasite_data_size (parasite),
NULL,
error);
}
else
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Empty text parasite"));
}
return text;
}
......
......@@ -394,6 +394,7 @@ app/propgui/gimppropgui.c
app/text/gimpfont.c
app/text/gimpfontfactory.c
app/text/gimptext-compat.c
app/text/gimptext-parasite.c
app/text/gimptextlayer.c
app/text/gimptextlayer-transform.c
app/text/gimptextlayer-xcf.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment