[BUG] Calling find_name() in the wrong order makes things unfindable
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 270
- Avg merge
- 5d 19h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
The repro below panics with "tv" being `None` when unwrapped. If the two `find_name()` calls are swapped there is no problem.
I don't think this is mentioned as a something to be avoided anywhere. I am still fairly new to Rust so my apologies if there is something idiomatic I'm missing here.
**To Reproduce**
```
use cursive::{
view::Nameable,
views::{Dialog, TextView},
};
fn main() {
let mut siv = cursive::default();
siv.add_layer(Dialog::around(TextView::new("tv").with_name("tv")).with_name("d"));
let _a = siv.find_name::("d").unwrap();
let _b = siv.find_name::("tv").unwrap();
}
```
**Expected behavior**
Order of calls to `find_name()` makes no difference. If the problem was just I should drop the result of `find_name()` before making another call, that would be fine with me provided it were documented/enforced.
**Environment**
* Operating system used: macOS 13.5.1
* Backend used: ncurses
* Current locale: en_US.UTF-8
* Cursive version: 75bc082350e7d5c3d006040d3392f524d5170f55
Contributor guide
Assessment
This issue has not been assessed yet.