Skip to content

Commit 1e68cdb

Browse files
Cvc null check profile (#254)
* null checks on mixer profile * style fix to conform with the rest of the code
1 parent a87c98c commit 1e68cdb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: libcvc/gvc-mixer-control.c

+5
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ gvc_mixer_control_change_profile_on_selected_device (GvcMixerControl *control,
549549
g_object_get (G_OBJECT (device), "card", &card, NULL);
550550
current_profile = gvc_mixer_card_get_profile (card);
551551

552+
if (!current_profile) {
553+
g_warning("gvc_mixer_card_get_profile() returned NULL for card %p", card);
554+
return FALSE;
555+
}
556+
552557
if (current_profile)
553558
best_profile = gvc_mixer_ui_device_get_best_profile (device, profile, current_profile->profile);
554559
else

Diff for: libcvc/gvc-mixer-ui-device.c

+5
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ gvc_mixer_ui_device_get_active_profile (GvcMixerUIDevice* device)
557557
}
558558

559559
profile = gvc_mixer_card_get_profile (device->priv->card);
560+
if (!profile) {
561+
g_warning ("gvc_mixer_card_get_profile() returned NULL for card %p", device->priv->card);
562+
return NULL;
563+
}
564+
560565
return gvc_mixer_ui_device_get_matching_profile (device, profile->profile);
561566
}
562567

0 commit comments

Comments
 (0)