From 3dd49272816dbbde1079a3d46c3249dcf6ca0f40 Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Mon, 30 Oct 2017 13:20:40 +0100 Subject: [PATCH] Forbid empty titles in application layer --- src/state.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/state.rs b/src/state.rs index 3063db2..641c002 100644 --- a/src/state.rs +++ b/src/state.rs @@ -204,6 +204,10 @@ impl State { let connection_pool = self.connection_pool.clone(); self.cpu_pool.spawn_fn(move || { + if title.is_empty() { + Err("title cannot be empty")?; + } + let conn = connection_pool.get()?; conn.transaction(|| { @@ -263,6 +267,10 @@ impl State { let connection_pool = self.connection_pool.clone(); self.cpu_pool.spawn_fn(move || { + if title.is_empty() { + Err("title cannot be empty")?; + } + let conn = connection_pool.get()?; conn.transaction(|| {