Skip to content
Snippets Groups Projects
Commit 9de822ce authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

video: don't always clear default device when calling removeDevice

- Checks if there are still video devices in the list, and if so,
  sets the default to the 0th, otherwise empties the string.

Change-Id: Ib7fed45bf2d32d1d41c6286b4d62c71183eed39d
parent e75fb153
Branches
Tags
No related merge requests found
......@@ -237,10 +237,16 @@ VideoDeviceMonitor::removeDevice(const string& node)
if (it == devices_.end())
return;
if (defaultDevice_ == it->name)
defaultDevice_.clear();
auto removedDeviceName = it->name;
devices_.erase(it);
if (defaultDevice_ == removedDeviceName) {
if (devices_.size() == 0) {
defaultDevice_.clear();
} else {
defaultDevice_ = devices_[0].name;
}
}
}
notify();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment