Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null value error on txt export #42

Closed
Selovert opened this issue Dec 29, 2022 · 4 comments · Fixed by #43
Closed

Null value error on txt export #42

Selovert opened this issue Dec 29, 2022 · 4 comments · Fixed by #43
Assignees
Labels
bug Something isn't working exporter Related to exporter processes txt Related to TXT Export

Comments

@Selovert
Copy link

Selovert commented Dec 29, 2022

To preface: I'm not familiar with rust, but will try to provide helpful information!

I'm running imessage-exporter -f txt and seeing the following output:

Building cache...
[1/4] Caching chats...
[2/4] Caching chatrooms...
[3/4] Caching participants...
[4/4] Caching reactions...
Cache built!
Exporting to /Users/tassilo/imessage_export as txt...
⠓ [2s] [################>---] 103216/123664 (39,193.6516/s, ETA: 1s)
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/tassilo/.cargo/registry/src/github.com-1ecc6299db9ec823/imessage-exporter-0.1.2/src/exporters/txt.rs:337:42

Attempted to pull a backtrace by running RUST_BACKTRACE=full imessage-exporter -f txt:

stack backtrace:
   0:        0x1041ba34c - std::backtrace_rs::backtrace::libunwind::trace::hbe97f4303076f99a
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:        0x1041ba34c - std::backtrace_rs::backtrace::trace_unsynchronized::hb462a91ac605b16b
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x1041ba34c - std::sys_common::backtrace::_print_fmt::h555c176cf2344151
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5
   3:        0x1041ba34c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he84d5e26d26c914d
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22
   4:        0x1041d526c - core::fmt::write::h07c7e4739f78f3b0
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17
   5:        0x1041b6f5c - std::io::Write::write_fmt::h4a3c5f094ffc65e8
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15
   6:        0x1041ba160 - std::sys_common::backtrace::_print::h03a1c9ac6001091a
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5
   7:        0x1041ba160 - std::sys_common::backtrace::print::h6fc2cc8be2392a8e
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9
   8:        0x1041bb7b4 - std::panicking::default_hook::{{closure}}::h3bb44ba6ff437e23
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22
   9:        0x1041bb50c - std::panicking::default_hook::h92c6668a1a98ae8c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9
  10:        0x1041bbdf0 - std::panicking::rust_panic_with_hook::h9b8acc949e1fb807
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:688:13
  11:        0x1041bbbc4 - std::panicking::begin_panic_handler::{{closure}}::hfc38b2cc56e3623c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:577:13
  12:        0x1041ba7b4 - std::sys_common::backtrace::__rust_end_short_backtrace::hbafd151207fc448f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:137:18
  13:        0x1041bb954 - rust_begin_unwind
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
  14:        0x1041e8b38 - core::panicking::panic_fmt::h8c7f3d540a75578f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
  15:        0x1041e8bcc - core::panicking::panic::h2505ca165b8854d6
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:115:5
  16:        0x1040f9764 - <imessage_exporter::exporters::txt::TXT as imessage_exporter::exporters::exporter::Writer>::format_message::h1bcefd6001801411
  17:        0x1040f69c0 - <imessage_exporter::exporters::txt::TXT as imessage_exporter::exporters::exporter::Exporter>::iter_messages::h5ed45f1370a5180d
  18:        0x1041017ec - imessage_exporter::app::runtime::Config::start::h1b7f6ac2978263f9
  19:        0x1040f2908 - imessage_exporter::main::h38ca28207216a674
  20:        0x1040fe79c - std::sys_common::backtrace::__rust_begin_short_backtrace::h85560146c1c1ecb9
  21:        0x104101f00 - std::rt::lang_start::{{closure}}::hb95f493d3c11ff53
  22:        0x1041b223c - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::ha4b10a239e2af884
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:286:13
  23:        0x1041b223c - std::panicking::try::do_call::h6b4bcb7d3635e86a
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  24:        0x1041b223c - std::panicking::try::h579c8cca81ff0f69
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  25:        0x1041b223c - std::panic::catch_unwind::h4a997c12755a6e33
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  26:        0x1041b223c - std::rt::lang_start_internal::{{closure}}::hf20057b44f57f87c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:148:48
  27:        0x1041b223c - std::panicking::try::do_call::hdfca34da16d8863f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  28:        0x1041b223c - std::panicking::try::h4f4022e500de0807
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  29:        0x1041b223c - std::panic::catch_unwind::h62721286166676e8
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  30:        0x1041b223c - std::rt::lang_start_internal::h659a783147314d97
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:148:20
  31:        0x1040f2a3c - _main

Here's the output of imessage-exporter -d:

Building cache...
[1/4] Caching chats...
[2/4] Caching chatrooms...
[3/4] Caching participants...
[4/4] Caching reactions...
Cache built!

iMessage Database Diagnostics

Messages not associated with a chat: 68
Missing attachment data:
    Missing files: 24
    ck_server_change_token_blob: 7
Duplicated contacts: 63
Duplicated chats: 47
Done!

Running imessage-exporter -f html works fine and it looks like the message triggering the error is this one (it's the next message at the point of failure):

image

Version for reference:
imessage-exporter --version: iMessage Exporter 0.1.2

@ReagentX
Copy link
Owner

ReagentX commented Dec 29, 2022

Thank you for this amazing bug report! The issue appears to be the unwrap() call here:

Some(sticker) => sticker.filename.as_ref().unwrap(),

It doesn't crash for HTML exports because the None variant is handled properly there:

Some(sticker) => match self.format_attachment(sticker) {
Ok(img) => {
let who = self.config.who(&msg.handle_id, msg.is_from_me);
Some(format!("{img}<span class=\"reaction\"> from {who}</span>"))
}
Err(_) => None,
},

ReagentX added a commit that referenced this issue Dec 29, 2022
@ReagentX ReagentX mentioned this issue Dec 29, 2022
@ReagentX
Copy link
Owner

There is also another bug there, in the HTML export it doesn't show who send the missing sticker.

@ReagentX
Copy link
Owner

You should be able to avoid this crash by installing the latest update from crates.io with cargo install imessage-exporter.

@Selovert
Copy link
Author

Success; much appreciated :). Glad the bug report was helpful!

image

@ReagentX ReagentX added bug Something isn't working txt Related to TXT Export exporter Related to exporter processes labels Dec 30, 2022
@ReagentX ReagentX self-assigned this Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exporter Related to exporter processes txt Related to TXT Export
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants