diff options
author | krukai | 2020-06-27 17:01:58 +0200 |
---|---|---|
committer | Luís Pereira | 2020-06-30 23:44:04 +0200 |
commit | 9f4cc242f031f8659a171bba32a475c9545a0d77 (patch) | |
tree | 9209bfd386d74fb033eb46a1b35a58e0918f2bf3 | |
parent | Merge pull request #156 from milotype/milotype (diff) | |
download | pavucontrol-slx-9f4cc242f031f8659a171bba32a475c9545a0d77.tar.gz pavucontrol-slx-9f4cc242f031f8659a171bba32a475c9545a0d77.tar.xz pavucontrol-slx-9f4cc242f031f8659a171bba32a475c9545a0d77.zip |
Safely iterate over card profile info array
-rw-r--r-- | src/mainwindow.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 83e4964..e3e25ca 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -209,7 +209,7 @@ void MainWindow::updateCard(const pa_card_info &info) { w->hasSinks = w->hasSources = false; profile_priorities.clear(); - for (pa_card_profile_info2 ** p_profile = info.profiles2; *p_profile != nullptr; ++p_profile) { + for (pa_card_profile_info2 ** p_profile = info.profiles2; p_profile && *p_profile != nullptr; ++p_profile) { w->hasSinks = w->hasSinks || ((*p_profile)->n_sinks > 0); w->hasSources = w->hasSources || ((*p_profile)->n_sources > 0); profile_priorities.insert(*p_profile); @@ -225,7 +225,7 @@ void MainWindow::updateCard(const pa_card_info &info) { p.available = info.ports[i]->available; p.direction = info.ports[i]->direction; p.latency_offset = info.ports[i]->latency_offset; - for (pa_card_profile_info2 ** p_profile = info.ports[i]->profiles2; *p_profile != nullptr; ++p_profile) + for (pa_card_profile_info2 ** p_profile = info.ports[i]->profiles2; p_profile && *p_profile != nullptr; ++p_profile) p.profiles.push_back((*p_profile)->name); w->ports[p.name] = p; |