mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Avoid crashing when no homepage preference is set.
This commit is contained in:
parent
6a9aac3e65
commit
4f7b44c850
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>"
|
||||||
|
|
|
@ -319,7 +319,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