Bug 784700 - Bug fix for crash with metadata editor when some fields are empty

This commit is contained in:
draekko 2017-07-08 13:09:36 -04:00 committed by Michael Natterer
parent 23ae146d95
commit 84b099342c
1 changed files with 34 additions and 51 deletions

View File

@ -4290,6 +4290,10 @@ set_tag_string (GimpMetadata *metadata,
{
gexiv2_metadata_clear_tag (GEXIV2_METADATA (metadata), name);
if (metadata == NULL) return;
if (name == NULL) return;
if (value == NULL) return;
if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
name, value))
{
@ -4919,6 +4923,8 @@ metadata_editor_write_callback (GtkWidget *dialog,
strcpy (type1, phone_types[0].data);
if (tag_data != NULL)
{
for (types = 0; types < 6; types++)
{
if (! strcmp (tag_data, phone_types[types].display))
@ -4927,6 +4933,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
break;
}
}
}
set_tag_string (g_metadata, tag, type1);
@ -4949,15 +4956,19 @@ metadata_editor_write_callback (GtkWidget *dialog,
strcpy (type2, phone_types[0].data);
if (tag_data != NULL)
{
for (types = 0; types < 6; types++)
{
g_print("%d %s %s\n", types, tag_data, phone_types[types].display);
if (! strcmp (tag_data, phone_types[types].display))
{
g_print("%d %s \n", types, phone_types[types].data);
strcpy (type2, phone_types[types].data);
break;
}
}
}
set_tag_string (g_metadata, tag, type2);
gtk_tree_model_get (treemodel, &iter,
@ -5403,13 +5414,9 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
if (value == 0)
{
if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag))
{
g_printerr ("failed to clear tag [%s]\n",
gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag);
}
}
else
{
gchar *save;
@ -5428,12 +5435,8 @@ metadata_editor_write_callback (GtkWidget *dialog,
switch (value)
{
case 0:
if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag))
{
g_printerr ("failed to clear tag [%s]\n",
gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag);
}
break;
case 1:
@ -5473,12 +5476,8 @@ metadata_editor_write_callback (GtkWidget *dialog,
switch (value)
{
case 0:
if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag))
{
g_printerr ("failed to clear tag [%s]\n",
gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag);
}
break;
case 1:
@ -5500,12 +5499,8 @@ metadata_editor_write_callback (GtkWidget *dialog,
switch (value)
{
case 0:
if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag))
{
g_printerr ("failed to clear tag [%s]\n",
gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag);
}
break;
case 1:
@ -5527,12 +5522,8 @@ metadata_editor_write_callback (GtkWidget *dialog,
switch (value)
{
case 0:
if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag))
{
g_printerr ("failed to clear tag [%s]\n",
gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag);
}
break;
case 1:
@ -5560,13 +5551,9 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
if (value == 0)
{
if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag))
{
g_printerr ("failed to clear tag [%s]\n",
gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag);
}
}
else
{
gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata),
@ -5579,13 +5566,9 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
if (value == 0)
{
if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag))
{
g_printerr ("failed to clear tag [%s]\n",
gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
default_metadata_tags[i].tag);
}
}
else
{
gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata),