summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-12-18 13:46:58 +0100
committerGravatar waker <wakeroid@gmail.com>2011-12-18 13:46:58 +0100
commit1d307b9f84fb73ab7b047ec15b70cbe53225a962 (patch)
tree53fe7dffea23a8e5b6375594b3cdd4e250eb0034
parent727d44ab2f9b67c5f6b59484b3016f1a44f93215 (diff)
converter: disallow empty preset titles
-rw-r--r--plugins/converter/converter.c8
-rw-r--r--plugins/converter/convgui.c2
2 files changed, 8 insertions, 2 deletions
diff --git a/plugins/converter/converter.c b/plugins/converter/converter.c
index 39604785..84d73748 100644
--- a/plugins/converter/converter.c
+++ b/plugins/converter/converter.c
@@ -149,6 +149,10 @@ encoder_preset_load (const char *fname) {
// @return -1 on path/write error, -2 if file already exists
int
encoder_preset_save (ddb_encoder_preset_t *p, int overwrite) {
+ if (!p->title || !p->title[0]) {
+ fprintf (stderr, "encoder_preset_save: empty title\n");
+ return -1;
+ }
const char *confdir = deadbeef->get_config_dir ();
char path[1024];
if (snprintf (path, sizeof (path), "%s/presets", confdir) < 0) {
@@ -349,6 +353,10 @@ dsp_preset_load (const char *fname) {
int
dsp_preset_save (ddb_dsp_preset_t *p, int overwrite) {
+ if (!p->title || !p->title[0]) {
+ fprintf (stderr, "dsp_preset_save: empty title\n");
+ return -1;
+ }
const char *confdir = deadbeef->get_config_dir ();
char path[1024];
if (snprintf (path, sizeof (path), "%s/presets", confdir) < 0) {
diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c
index bd54eb0e..d214d222 100644
--- a/plugins/converter/convgui.c
+++ b/plugins/converter/convgui.c
@@ -690,11 +690,9 @@ on_encoder_preset_add (GtkButton *button,
current_ctx->current_encoder_preset = converter_plugin->encoder_preset_alloc ();
if (GTK_RESPONSE_OK == edit_encoder_preset (_("Add new encoder"), toplevel, 0)) {
- printf ("added new enc preset\n");
converter_plugin->encoder_preset_append (current_ctx->current_encoder_preset);
GtkComboBox *combo = GTK_COMBO_BOX (lookup_widget (current_ctx->converter, "encoder"));
GtkWidget *list = lookup_widget (toplevel, "presets");
- printf ("refresh list\n");
refresh_encoder_lists (combo, GTK_TREE_VIEW (list));
}