fix: crash in debug mode

This commit is contained in:
Cyrix126 2024-08-29 09:05:03 +02:00
parent 3e8fabc996
commit 5ef98e9ab8
2 changed files with 6 additions and 6 deletions
src/app/panels
bottom.rs
middle/p2pool

View file

@ -83,7 +83,7 @@ impl crate::app::App {
});
ui.with_layout(Layout::right_to_left(Align::RIGHT), |ui| {
let width = (ui.available_width() / 3.0) - (SPACE * 3.0);
let width = ((ui.available_width() / 3.0) - (SPACE * 3.0)).max(0.0);
let size = vec2(width, height);
// [Save/Reset]
self.save_reset_ui(ui, size, key, wants_input);
@ -318,7 +318,7 @@ impl crate::app::App {
key: &KeyPressed,
) {
ui.group(|ui| {
let width = (ui.available_width() / 3.0) - 5.0;
let width = ((ui.available_width() / 3.0) - 5.0).max(0.0);
let size = vec2(width, height);
if p2pool_is_waiting {
ui.add_enabled_ui(false, |ui| {
@ -591,7 +591,7 @@ impl crate::app::App {
wants_input: bool,
) {
ui.group(|ui| {
let width = (ui.available_width() / 3.0) - 5.0;
let width = ((ui.available_width() / 3.0) - 5.0).max(0.0);
let size = vec2(width, height);
if xvb_is_waiting {
ui.add_enabled_ui(false, |ui| {

View file

@ -23,7 +23,7 @@ impl P2pool {
// [Node]
let height = size.y / 13.0;
let space_h = size.y / 96.0;
ui.spacing_mut().slider_width = size.x - 16.0;
ui.spacing_mut().slider_width = (size.x - 16.0).max(0.0);
ui.spacing_mut().icon_width = size.x / 25.0;
// [Auto-select] if we haven't already.
@ -78,7 +78,7 @@ impl P2pool {
debug!("P2Pool Tab | Rendering [Select fastest ... Ping] buttons");
ui.horizontal(|ui| {
let width = (size.x / 5.0) - 6.0;
let width = ((size.x / 5.0) - 6.0).max(0.0);
let size = vec2(width, height);
// [Select random node]
if ui
@ -160,7 +160,7 @@ impl P2pool {
debug!("P2Pool Tab | Rendering [Auto-*] buttons");
ui.group(|ui| {
ui.horizontal(|ui| {
let width = (size.x / 3.0) - (SPACE * 1.75);
let width = ((size.x / 3.0) - (SPACE * 1.75)).max(0.0);
let size = vec2(width, height);
// [Auto-node]
ui.add_sized(size, Checkbox::new(&mut self.auto_select, "Auto-select"))