]> git.seodisparate.com - EN605.607.81.SP22_ASDM_Project/commitdiff
back-end: Minor fix related to phrase handling
authorStephen Seo <seo.disparate@gmail.com>
Wed, 27 Apr 2022 05:15:54 +0000 (14:15 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 27 Apr 2022 05:16:34 +0000 (14:16 +0900)
Fixes passing an empty string to the db in (probably) rare cases.

back_end/src/json_handlers.rs

index acacafa9c614923cacaf01d249fbbfcdd7765f26..e10a62f241ec6b1fcb68bdad19a14213603ebddc 100644 (file)
@@ -56,7 +56,10 @@ fn handle_pairing_request(root: Value, tx: SyncSender<DBHandlerRequest>) -> Resu
                         phrase_str = phrase_str.split_at(idx).0;
                     }
                 }
-                phrase = Some(phrase_str.to_owned());
+
+                if !phrase_str.is_empty() {
+                    phrase = Some(phrase_str.to_owned());
+                }
             }
         }
     }