fix: don't observe WebUSB for in-memory partitions (#42443)

This commit is contained in:
Shelley Vohr 2024-06-12 10:59:04 -05:00 committed by GitHub
parent 4aa9070e6c
commit 6caf9f06f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -46,8 +46,8 @@ class ElectronHidDelegate::ContextObservation
ContextObservation(ElectronHidDelegate* parent,
content::BrowserContext* browser_context)
: parent_(parent), browser_context_(browser_context) {
auto* chooser_context = GetChooserContext(browser_context_);
device_observation_.Observe(chooser_context);
if (auto* chooser_context = GetChooserContext(browser_context_))
device_observation_.Observe(chooser_context);
}
ContextObservation(ContextObservation&) = delete;

View file

@ -94,7 +94,8 @@ class ElectronUsbDelegate::ContextObservation
content::BrowserContext* browser_context)
: parent_(parent), browser_context_(browser_context) {
auto* chooser_context = GetChooserContext(browser_context_);
device_observation_.Observe(chooser_context);
if (chooser_context)
device_observation_.Observe(chooser_context);
}
ContextObservation(ContextObservation&) = delete;
ContextObservation& operator=(ContextObservation&) = delete;