aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-08 12:54:52 -0500
committerDavid Robillard <d@drobilla.net>2023-01-08 12:54:52 -0500
commita3ccd8a4c5125bd12c017261ffdbc0de7759d62b (patch)
treef8f89a36fd92f78fb51eeb9be7abb84791eae549 /src
parent1efbab15eed92c5579a5c0348794e8b9b48732a8 (diff)
downloadpugl-a3ccd8a4c5125bd12c017261ffdbc0de7759d62b.tar.gz
pugl-a3ccd8a4c5125bd12c017261ffdbc0de7759d62b.tar.bz2
pugl-a3ccd8a4c5125bd12c017261ffdbc0de7759d62b.zip
Gracefully handle out of range hints
Diffstat (limited to 'src')
-rw-r--r--src/common.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/common.c b/src/common.c
index f0292ab..663cf28 100644
--- a/src/common.c
+++ b/src/common.c
@@ -212,14 +212,22 @@ puglSetViewHint(PuglView* view, PuglViewHint hint, int value)
}
}
- view->hints[hint] = value;
- return PUGL_SUCCESS;
+ if (hint >= 0 && hint < PUGL_NUM_VIEW_HINTS) {
+ view->hints[hint] = value;
+ return PUGL_SUCCESS;
+ }
+
+ return PUGL_BAD_PARAMETER;
}
int
puglGetViewHint(const PuglView* view, PuglViewHint hint)
{
- return view->hints[hint];
+ if (hint >= 0 && hint < PUGL_NUM_VIEW_HINTS) {
+ return view->hints[hint];
+ }
+
+ return PUGL_DONT_CARE;
}
PuglRect