Skip to content

Commit

Permalink
Prevent crash on invalid geojson
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Apr 8, 2024
1 parent 46b225e commit 9f56d0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<geojson::GeoJson>().unwrap();
let geojson: geojson::GeoJson = decrypted_string.parse::<geojson::GeoJson>()?;
let features_collection: FeatureCollection =
FeatureCollection::try_from(geojson).unwrap();
FeatureCollection::try_from(geojson)?;

//println!("Successfully decrypted");
//println!("{}", decrypted_string);
Expand Down

0 comments on commit 9f56d0d

Please sign in to comment.