Fix build failure when compiling in release
Compiling with --buildtype=release fails with message: ../main.c:935:17: error: argument 2 null where non-null expected [-Werror=nonnull] 935 | memcpy(state->text + state->cursor, s, n); GCC only produces this error with optimizations enabled. Looking at the build output I assume this happens because it tries to inline the function.
This commit is contained in:
parent
adf5cda6e1
commit
e120b9156e
1 changed files with 1 additions and 1 deletions
2
main.c
2
main.c
|
@ -931,7 +931,7 @@ void insert(struct menu_state *state, const char *s, ssize_t n) {
|
|||
}
|
||||
memmove(state->text + state->cursor + n, state->text + state->cursor,
|
||||
sizeof state->text - state->cursor - MAX(n, 0));
|
||||
if (n > 0) {
|
||||
if (n > 0 && s != NULL) {
|
||||
memcpy(state->text + state->cursor, s, n);
|
||||
}
|
||||
state->cursor += n;
|
||||
|
|
Loading…
Add table
Reference in a new issue