Crash on empty UI.
bug
## Description
When you have an empty UI scene I get the following crash:
```
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
stack backtrace:
0: rust_begin_unwind
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:662:5
1: core::panicking::panic_nounwind_fmt::runtime
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:112:18
2: core::panicking::panic_nounwind_fmt
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:122:5
3: core::panicking::panic_nounwind
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:221:5
4: core::slice::raw::from_raw_parts::precondition_check
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ub_checks.rs:70:21
5: core::slice::raw::from_raw_parts
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ub_checks.rs:77:17
6: imgui::render::draw_data::DrawData::cmd_lists
at /home/toaster/.cargo/registry/src/index.crates.io-6f17d22bba15001f/imgui-0.12.0/src/render/draw_data.rs:59:9
7: imgui::render::draw_data::DrawData::draw_lists
at /home/toaster/.cargo/registry/src/index.crates.io-6f17d22bba15001f/imgui-0.12.0/src/render/draw_data.rs:48:23
8: imgui_wgpu::Renderer::prepare
at /home/toaster/.cargo/git/checkouts/imgui-wgpu-rs-7931b819800fb253/bab0725/src/lib.rs:585:26
9: imgui_wgpu::Renderer::render
at /home/toaster/.cargo/git/checkouts/imgui-wgpu-rs-7931b819800fb253/bab0725/src/lib.rs:693:33
10: eos_engine::ui::Ui::render
at ./src/ui/mod.rs:141:9
11: eos_engine::render::pipeline_manager::PipelineManager::render
at ./src/render/pipeline_manager.rs:174:13
12: eos_engine::render::RenderState::render
at ./src/render/mod.rs:235:17
13: eos_engine::app::App::run::{{closure}}::{{closure}}
at ./src/app.rs:417:29
```
You can bypass this by adding your own check to see if you've written UI, however this causes another another issue:
```
game: ./third-party/imgui-master/imgui/imgui.cpp:8880: void ImGui::ErrorCheckNewFrameSanityChecks(): Assertion `(g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?"' failed.
```
## Repro steps
Run without calling any ui functions.
## Extra Materials
No
## System Information
Linux/x11/wayland/nvidia
2 条评论