abstreet icon indicating copy to clipboard operation
abstreet copied to clipboard

called `Option::unwrap()` on a `None` value saving proposal after adding custom boundary

Open nmbooker opened this issue 2 years ago • 2 comments

I launched 'ltn' with rugby-and-environs map loaded. Created a custom boundary, gave it a name, then tried to save my proposal straight away (so I didn't lose the work creating the boundary). After typing the filename and clicking the Submit button (or was it labelled Save?), this traceback happened:

Traceback:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/runner/work/abstreet/abstreet/abstutil/src/collections.rs:148:51
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:48:5
   3: abstutil::collections::Counter<T>::max_key
   4: ltn::save::PreserveState::switch_to_state
   5: <ltn::save::SaveDialog as widgetry::app_state::State<ltn::app::App>>::event
   6: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
   7: widgetry::runner::State<A>::event
   8: widgetry::runner::run::{{closure}}
   9: winit::platform_impl::platform::x11::EventLoop<T>::drain_events::{{closure}}::{{closure}}
  10: winit::platform_impl::platform::x11::EventLoop<T>::drain_events::{{closure}}
  11: winit::platform_impl::platform::x11::event_processor::EventProcessor<T>::process_event
  12: winit::platform_impl::platform::x11::EventLoop<T>::run_return::single_iteration
  13: winit::platform_impl::platform::x11::EventLoop<T>::run
  14: winit::platform_impl::platform::EventLoop<T>::run
  15: winit::event_loop::EventLoop<T>::run
  16: widgetry::runner::run
  17: ltn::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[2023-02-14T18:20:32Z INFO  abstio::io_native] Wrote data/player/camera_state/zz/oneshot/rugby-and-environs.json
[2023-02-14T18:20:32Z INFO  abstio::io_native] Wrote data/player/maps.json
[nick@jay abstreet_linux_v0_3_39]$ ^C

Here's a screenshot of the custom boundary I created: Screenshot from 2023-02-14 18-18-57

Full output is here: ltn-full-output.txt

nmbooker avatar Feb 14 '23 18:02 nmbooker

More info on my system:

[nick@jay abstreet_linux_v0_3_39]$ uname -a
Linux jay 6.1.10-100.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Feb  6 19:58:39 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

nmbooker avatar Feb 14 '23 18:02 nmbooker

Hi, and thanks for the bug report! This is expected behavior right now; this custom boundary feature is new and has a bunch of limitations listed in #1044. I've unfortunately not had time to work through them yet. Maybe in the meantime, there should be a warning upfront that this tool is experimental?

For my own reference, the area you've drawn is near https://www.openstreetmap.org/#map=15/52.3753/-1.2488. You've made use of the tool for exactly one of the cases where it's intended -- your north boundary is the rail line, so adjusting a boundary block-by-block wouldn't work; it would insist on stretching to the nearest roads (Technology Drive and Butler's Leap?). After drawing this boundary, did the "Design LTN" tool work pretty reasonably for you?

dabreegster avatar Feb 15 '23 12:02 dabreegster