mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #27396 - jdm:home-button, r=Manishearth
Avoid crashing when no homepage preference is set. Fixes #27394.
This commit is contained in:
commit
8a5a5cb91b
2 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define FALLBACK_DEFAULT_URL L"https://servo.org/hl-home/"
|
||||||
|
|
||||||
// For development purpose.
|
// For development purpose.
|
||||||
// Will override shell.homepage preference:
|
// Will override shell.homepage preference:
|
||||||
// #define OVERRIDE_DEFAULT_URL L"data:text/html,<input>"
|
// #define OVERRIDE_DEFAULT_URL L"data:text/html,<input>"
|
||||||
|
|
|
@ -327,7 +327,9 @@ void Servo::GoHome() {
|
||||||
ApplicationDataContainer localSettings =
|
ApplicationDataContainer localSettings =
|
||||||
ApplicationData::Current().LocalSettings();
|
ApplicationData::Current().LocalSettings();
|
||||||
auto prefs = localSettings.Containers().Lookup(L"servoUserPrefs");
|
auto prefs = localSettings.Containers().Lookup(L"servoUserPrefs");
|
||||||
auto home = unbox_value<hstring>(prefs.Values().Lookup(L"shell.homepage"));
|
auto home_pref = prefs.Values().Lookup(L"shell.homepage");
|
||||||
|
auto home =
|
||||||
|
home_pref ? unbox_value<hstring>(home_pref) : FALLBACK_DEFAULT_URL;
|
||||||
LoadUri(home);
|
LoadUri(home);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue