mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
handle null args
This commit is contained in:
parent
7a5ce048d2
commit
2fb6cc6f4d
1 changed files with 10 additions and 7 deletions
|
@ -75,13 +75,16 @@ fn init(
|
||||||
) {
|
) {
|
||||||
crate::env_logger::init();
|
crate::env_logger::init();
|
||||||
|
|
||||||
let args = unsafe { CStr::from_ptr(opts.args) };
|
let args = if !opts.args.is_null() {
|
||||||
let args = args
|
let args = unsafe { CStr::from_ptr(opts.args) };
|
||||||
.to_str()
|
args.to_str()
|
||||||
.unwrap_or("")
|
.unwrap_or("")
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.map(|s| s.to_owned())
|
.map(|s| s.to_owned())
|
||||||
.collect();
|
.collect()
|
||||||
|
} else {
|
||||||
|
vec![]
|
||||||
|
};
|
||||||
|
|
||||||
let url = unsafe { CStr::from_ptr(opts.url) };
|
let url = unsafe { CStr::from_ptr(opts.url) };
|
||||||
let url = url.to_str().map(|s| s.to_string()).ok();
|
let url = url.to_str().map(|s| s.to_string()).ok();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue