From 0fc35956ae709554d79a50d5aed7bf3a72dc67a2 Mon Sep 17 00:00:00 2001 From: Theo Beers <32523293+theodore-s-beers@users.noreply.github.com> Date: Mon, 28 Mar 2022 19:15:05 +0200 Subject: [PATCH] Add another early out --- src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.rs b/src/main.rs index 704cffb..9575ca9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,6 +40,10 @@ async fn index(path: web::Path) -> impl Responder { let lines: Vec = parsed.select(&line_selector).collect(); + if lines.is_empty() { + return HttpResponse::Ok().body("Something went wrong!"); + } + let mut collected = String::new(); for element in lines {