Skip to content

Commit c957e93

Browse files
committed
Be defensive against invalid sizes
1 parent 0357bc7 commit c957e93

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/ark/src/ui/ui.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ impl UiComm {
198198
&self,
199199
params: DidChangePlotsRenderSettingsParams,
200200
) -> anyhow::Result<UiBackendReply, anyhow::Error> {
201+
// The frontend shoudn't send invalid sizes but be defensive. Sometimes
202+
// the plot container is in a strange state when it's hidden.
203+
if params.settings.size.height <= 0 || params.settings.size.width <= 0 {
204+
return Err(anyhow::anyhow!(
205+
"Got invalid plot render size: {size:?}",
206+
size = params.settings.size,
207+
));
208+
}
209+
201210
self.graphics_device_tx
202211
.send(GraphicsDeviceNotification::DidChangePlotRenderSettings(
203212
params.settings,

0 commit comments

Comments
 (0)