Skip to content

Commit

Permalink
chore(screenshot): print no title if url doesn't have one // closes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnwriter committed Oct 17, 2023
1 parent 661e700 commit b062793
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/cli/screenshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,14 @@ async fn take_screenshot(
.await?;

if !silent {
let title = page.get_title().await.unwrap_or_default().unwrap();
show_info(url, title, res.status());
match page.get_title().await {
Ok(Some(title)) => show_info(url.clone(), title, res.status()),
_ => {
let title = "No title".to_string();
show_info(url.clone(), title, res.status());
}
}
}

page.close().await?;

Ok(())
Expand Down

0 comments on commit b062793

Please sign in to comment.