aboutsummaryrefslogtreecommitdiff
path: root/src/base.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-08-06 19:24:17 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-08-06 19:25:56 +0200
commit745820dd18d62286cb9bb8c2d83c5fb00afef649 (patch)
treead5a3ea48458400f0340b7513f9fd6fe7013e8e6 /src/base.c
parent47a8a06604747ab156ebeac903ec6ef182dfc529 (diff)
downloadd2tk-745820dd18d62286cb9bb8c2d83c5fb00afef649.tar.xz
base: handle empty tables.
Diffstat (limited to 'src/base.c')
-rw-r--r--src/base.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/base.c b/src/base.c
index fcd07a5..0a68dd0 100644
--- a/src/base.c
+++ b/src/base.c
@@ -324,6 +324,11 @@ D2TK_API d2tk_table_t *
d2tk_table_begin(const d2tk_rect_t *rect, unsigned N, unsigned M,
d2tk_flag_t flag, d2tk_table_t *tab)
{
+ if( (N == 0) || (M == 0) )
+ {
+ return NULL;
+ }
+
unsigned w;
unsigned h;
@@ -360,7 +365,7 @@ d2tk_table_begin(const d2tk_rect_t *rect, unsigned N, unsigned M,
D2TK_API bool
d2tk_table_not_end(d2tk_table_t *tab)
{
- return tab->k < tab->NM;
+ return tab && (tab->k < tab->NM);
}
D2TK_API d2tk_table_t *