Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Fix JSON error when no arguments are passed #21308

Merged
merged 1 commit into from Aug 1, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -95,12 +95,14 @@ pub fn init(
) -> Result<(), &'static str> {
resources::set(Box::new(ResourceReader(readfile)));

let mut args: Vec<String> = serde_json::from_str(&argsline).map_err(|_| {
"Invalid arguments. Servo arguments must be formatted as a JSON array"
})?;
// opts::from_cmdline_args expects the first argument to be the binary name.
args.insert(0, "servo".to_string());
opts::from_cmdline_args(&args);
if !argsline.is_empty() {
let mut args: Vec<String> = serde_json::from_str(&argsline).map_err(|_| {
"Invalid arguments. Servo arguments must be formatted as a JSON array"
})?;
// opts::from_cmdline_args expects the first argument to be the binary name.
args.insert(0, "servo".to_string());
opts::from_cmdline_args(&args);
}

let embedder_url = embedder_url.as_ref().and_then(|s| {
ServoUrl::parse(s).ok()
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.