}
}
}
- if (!have_actions) {
+ if (new && !have_actions) {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "metric %s has no actions", metric_name);
return FALSE;
}
}
}
}
- else {
+ else if (new) {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "metric %s has no symbols", metric_name);
return FALSE;
}
}
/* Insert the resulting metric */
- g_hash_table_insert (cfg->metrics, (void *)metric->name, metric);
- cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric);
+ if (new) {
+ g_hash_table_insert (cfg->metrics, (void *)metric->name, metric);
+ cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric);
+ }
return TRUE;
}