tCheck for invalid row/column - ltk - Socket-based GUI for X11 (WIP)
HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
HTML git clone https://lumidify.org/git/ltk.git (encrypted, but very slow)
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit b0116ddb464d93adf3eeb2cd64f8ac9920cfc443
DIR parent a4ab655cc97c6c7f7383e9567b413fd34819bb42
HTML Author: lumidify <nobody@lumidify.org>
Date: Mon, 1 Jun 2020 21:38:37 +0200
Check for invalid row/column
Diffstat:
M grid.c | 5 +++++
1 file changed, 5 insertions(+), 0 deletions(-)
---
DIR diff --git a/grid.c b/grid.c
t@@ -24,6 +24,7 @@
/* TODO: remove_widget function that also adjusts static width */
/* TODO: widget size request */
+#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
t@@ -194,6 +195,10 @@ void ltk_recalculate_grid(ltk_grid *grid) {
}
void ltk_grid_widget(ltk_widget *widget, ltk_grid *grid, int row, int column, int row_span, int column_span, unsigned short sticky) {
+ if (row >= grid->rows || column >= grid->columns) {
+ (void)fprintf(stderr, "Invalid row or column.\n");
+ return;
+ }
widget->sticky = sticky;
widget->row = row;
widget->column = column;