summaryrefslogtreecommitdiffstats
path: root/src/state.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-08-16 10:08:09 -0400
committerDavid Robillard <d@drobilla.net>2016-08-16 10:08:09 -0400
commita700a88b1ad68a9d223e65f4ee14b433c82b22de (patch)
tree222afaba75880d6d1b2b4cb2d568088e13a5aba9 /src/state.c
parent6f656dc9b5be2f33f519ec98e2f5ecaeea504997 (diff)
downloadlilv-a700a88b1ad68a9d223e65f4ee14b433c82b22de.tar.gz
lilv-a700a88b1ad68a9d223e65f4ee14b433c82b22de.tar.bz2
lilv-a700a88b1ad68a9d223e65f4ee14b433c82b22de.zip
Never call qsort on NULL
(Fix clang static analyzer warning)
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/state.c b/src/state.c
index f73e157..b852a31 100644
--- a/src/state.c
+++ b/src/state.c
@@ -604,8 +604,12 @@ new_state_from_model(LilvWorld* world,
free((void*)chunk.buf);
sratom_free(sratom);
- qsort(state->props.props, state->props.n, sizeof(Property), property_cmp);
- qsort(state->values, state->n_values, sizeof(PortValue), value_cmp);
+ if (state->props.props) {
+ qsort(state->props.props, state->props.n, sizeof(Property), property_cmp);
+ }
+ if (state->values) {
+ qsort(state->values, state->n_values, sizeof(PortValue), value_cmp);
+ }
return state;
}