From 4776f4ed4b87ecfb661e236d4e9b711eab0158e3 Mon Sep 17 00:00:00 2001 From: PhantomShift <83253309+PhantomShift@users.noreply.github.com> Date: Thu, 11 Apr 2024 22:04:16 -0400 Subject: [PATCH] Fix percent being able to resolve to NaN --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index eb67289..fb4f31b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -238,7 +238,11 @@ fn neko_to_kotatsu(input_path: String, output_path: PathBuf, verbose: bool) -> s scroll: 0, image_url: kotatsu_manga.cover_url.clone(), created_at: 0, - percent: chapter.last_page_read as f32 / (chapter.last_page_read as f32 + chapter.pages_left as f32), + percent: if chapter.last_page_read + chapter.pages_left == 0 { + 0.0 + } else { + chapter.last_page_read as f32 / (chapter.last_page_read as f32 + chapter.pages_left as f32) + }, }) }).collect::>(); if bookmarks.len() > 0 {