szunami / xwords-rs

Tools to fill crosswords
Apache License 2.0
7 stars 1 forks source link

Filler panics when given grid is already filled #135

Open super7ramp opened 1 year ago

super7ramp commented 1 year ago

Issue

Filler panics when given grid is already filled. That's a very minor corner case but still :)

Steps to reproduce

  1. Create the following file in grids/filled_4x4.txt
CFOS
BIRI
CCCV
SASA
  1. Call the filler using command-line interface: ./target/debug/xwords --input grids/filled_4x4.txt

Expected result

The grid is returned as is since it is valid.

Actual result

> ./target/debug/xwords --input grids/filled_4x4.txt 
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/fill/filler.rs:76:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/panicking.rs:65:14
   2: core::panicking::panic
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/panicking.rs:115:5
   3: core::option::Option<T>::unwrap
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/option.rs:778:21
   4: <xwords::fill::filler::Filler as xwords::fill::Fill>::fill
             at ./src/fill/filler.rs:65:27
   5: xwords::main
             at ./src/bin/xwords.rs:66:18
   6: core::ops::function::FnOnce::call_once
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
>

Environment

stable-x86_64-unknown-linux-gnu (default)
rustc 1.66.1 (90743e729 2023-01-10)