Ocarina: Check for a current alsa device before setting

Otherwise we set a C++ string to NULL and it throws an exception...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-02-09 08:04:01 -05:00
parent 9ead002ab8
commit 46ae66634e
1 changed files with 6 additions and 2 deletions

View File

@ -26,8 +26,12 @@ static void set_alsa_devices(bool using_alsa)
static void change_alsa_device(GtkComboBox *combo, gpointer data)
{
string device = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(alsa_devices));
libsaria::audio::set_device(device);
char *device = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(alsa_devices));
if (device != NULL) {
string dev = device;
libsaria::audio::set_device(dev);
g_free(device);
}
}
static void toggle_alsa(GtkWidget *button, gpointer data)