From a60201317916f20da676cbd807169b9e543b2275 Mon Sep 17 00:00:00 2001
From: Arthur Sonzogni <sonzogniarthur@gmail.com>
Date: Sun, 23 Apr 2023 16:14:50 +0200
Subject: [PATCH] Check graph area is positive. (#625)

Bug:https://github.com/ArthurSonzogni/FTXUI/issues/624
---
 src/ftxui/dom/graph.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/ftxui/dom/graph.cpp b/src/ftxui/dom/graph.cpp
index 1ab8f388..5425041f 100644
--- a/src/ftxui/dom/graph.cpp
+++ b/src/ftxui/dom/graph.cpp
@@ -39,6 +39,9 @@ class Graph : public Node {
   void Render(Screen& screen) override {
     const int width = (box_.x_max - box_.x_min + 1) * 2;
     const int height = (box_.y_max - box_.y_min + 1) * 2;
+    if (width <= 0 || height <= 0) {
+      return;
+    }
     auto data = graph_function_(width, height);
     int i = 0;
     for (int x = box_.x_min; x <= box_.x_max; ++x) {
-- 
GitLab