Skip to content

Commit

Permalink
Fixed version reading when no version is supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvalsw committed Jul 7, 2024
1 parent 78468a3 commit a0cfee5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vm/src/vm/runners/cairo_pie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,13 @@ impl CairoPie {
) -> Result<CairoPie, std::io::Error> {
use std::io::Read;

let reader = std::io::BufReader::new(zip_reader.by_name("version.json")?);
let version: CairoPieVersion = serde_json::from_reader(reader)?;
let version = match zip_reader.by_name("version.json") {
Ok(version_buffer) => {
let reader = std::io::BufReader::new(version_buffer);
serde_json::from_reader(reader)?
}
Err(_) => CairoPieVersion { cairo_pie: () },
};

let reader = std::io::BufReader::new(zip_reader.by_name("metadata.json")?);
let metadata: CairoPieMetadata = serde_json::from_reader(reader)?;
Expand Down

0 comments on commit a0cfee5

Please sign in to comment.