match post text value to avoid panic when field is empty
This commit is contained in:
parent
9434af37b9
commit
8128b32f40
@ -185,7 +185,10 @@ pub async fn get_root_posts(
|
|||||||
if !content_map.contains_key("root") {
|
if !content_map.contains_key("root") {
|
||||||
latest_sequence = msg.value.sequence;
|
latest_sequence = msg.value.sequence;
|
||||||
|
|
||||||
let text = content_map.get_key_value("text").unwrap().1.to_string();
|
let text = match content_map.get_key_value("text") {
|
||||||
|
Some(value) => value.1.to_string(),
|
||||||
|
None => String::from(""),
|
||||||
|
};
|
||||||
let timestamp = msg.value.timestamp.round() as i64 / 1000;
|
let timestamp = msg.value.timestamp.round() as i64 / 1000;
|
||||||
let datetime = NaiveDateTime::from_timestamp(timestamp, 0);
|
let datetime = NaiveDateTime::from_timestamp(timestamp, 0);
|
||||||
let date = datetime.format("%d %b %Y").to_string();
|
let date = datetime.format("%d %b %Y").to_string();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user