From 9f56d0d2967d95cd44e22595564ef85c509b4ea9 Mon Sep 17 00:00:00 2001 From: Kyler Chin <7539174+kylerchin@users.noreply.github.com> Date: Sun, 7 Apr 2024 22:48:56 -0700 Subject: [PATCH] Prevent crash on invalid geojson --- Cargo.toml | 2 +- src/lib.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7bb9f62..648010c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amtrak-gtfs-rt" -version = "0.2.0" +version = "0.2.1" license = "AGPL-3.0" description = "Converts Amtrak Track-A-Train to valid GTFS-rt vehicle and trip information" edition = "2021" diff --git a/src/lib.rs b/src/lib.rs index 7036d82..10c2af6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -505,11 +505,11 @@ pub async fn fetch_amtrak_gtfs_rt_joined( Ok(raw_data) => { //println!("Raw data successfully downloaded"); - let decrypted_string = amtk::decrypt(raw_data.text().await.unwrap().as_str()).unwrap(); + let decrypted_string = amtk::decrypt(raw_data.text().await.unwrap().as_str())?; - let geojson: geojson::GeoJson = decrypted_string.parse::().unwrap(); + let geojson: geojson::GeoJson = decrypted_string.parse::()?; let features_collection: FeatureCollection = - FeatureCollection::try_from(geojson).unwrap(); + FeatureCollection::try_from(geojson)?; //println!("Successfully decrypted"); //println!("{}", decrypted_string);