8LWXpg / jupyter2typst

Jupyter to Typst converter with template support
MIT License
11 stars 0 forks source link

Crash if encounters empty cell #2

Closed Eloitor closed 8 months ago

Eloitor commented 8 months ago

Description

If the original notebook contains an empty cell, the program crashes:

$  RUST_BACKTRACE=full jupyter2typst tables.ipynb 
thread 'main' panicked at src/body.rs:68:54:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x55613c3c50dc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc3b88a0ed6c5afbf
   1:     0x55613c3eda2b - core::fmt::write::hf0030323ef2de926
   2:     0x55613c3c1c0e - std::io::Write::write_fmt::h69911cb4c8790a1f
   3:     0x55613c3c4ec5 - std::sys_common::backtrace::print::he441f447f0231532
   4:     0x55613c3c6544 - std::panicking::default_hook::{{closure}}::hbd5dbffb1b120121
   5:     0x55613c3c6263 - std::panicking::default_hook::h35452db54148727c
   6:     0x55613c3c6aef - std::panicking::rust_panic_with_hook::h37faa341ad29f7fd
   7:     0x55613c3c6996 - std::panicking::begin_panic_handler::{{closure}}::h02e511cdf7bc65a2
   8:     0x55613c3c5606 - std::sys_common::backtrace::__rust_end_short_backtrace::h978128bcc3d8fca0
   9:     0x55613c3c6702 - rust_begin_unwind
  10:     0x55613c0f3ac5 - core::panicking::panic_fmt::hef80f46d93299868
  11:     0x55613c0f3b63 - core::panicking::panic::h6507cb08a66fcaa5
  12:     0x55613c121aa2 - jupyter2typst::body::ipynb_parse::h9006b105c86c1cb8
  13:     0x55613c126ab2 - jupyter2typst::main::h2377740750c95c41
  14:     0x55613c12abc3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4354c6aeb251f6fa
  15:     0x55613c128c09 - std::rt::lang_start::{{closure}}::hede78f39808e8fe4
  16:     0x55613c3bd808 - std::rt::lang_start_internal::h96d2d059d51f9fde
  17:     0x55613c127695 - main
  18:     0x7fab7f04018c - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  19:     0x7fab7f040245 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:381:3
  20:     0x55613c0f42a1 - _start
                               at /builddir/glibc-2.36/csu/../sysdeps/x86_64/start.S:115
  21:                0x0 - <unknown>

If I remove the empty cell it runs fine.