bhcli

A TUI for chatting on LE PHP Chats (onion)
git clone https://git.dasho.dev/n0tr1v/bhcli.git
Log | Files | Refs | README

commit 7e56e9431e448d7ca8168e41d1a391ca2bf0f53f
parent be0633c7cc3d486af021ca0ea5909aeb0a1b78bc
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun,  2 Apr 2023 07:03:45 -0700

handle error

Diffstat:
Msrc/main.rs | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs @@ -402,7 +402,13 @@ impl LeChatPHPClient { let doc = Document::from(resp_text.as_str()); let nc = doc.find(Attr("name", "nc")).next().unwrap(); let nc_value = nc.attr("value").unwrap().to_owned(); - let postid = doc.find(Attr("name", "postid")).next().unwrap(); + let postid = match doc.find(Attr("name", "postid")).next() { + Some(v) => v, + None => { + log::error!("failed to get postid"); + continue; + }, + }; let postid_value = postid.attr("value").unwrap().to_owned(); let mut params: Vec<(&str, String)> = vec![ ("lang", LANG.to_owned()),