diff --git a/libs/panners/vbap/vbap_speakers.cc b/libs/panners/vbap/vbap_speakers.cc index 79f5b230f7..1cf78797b7 100644 --- a/libs/panners/vbap/vbap_speakers.cc +++ b/libs/panners/vbap/vbap_speakers.cc @@ -116,6 +116,11 @@ VBAPSpeakers::choose_speaker_triplets(struct ls_triplet_chain **ls_triplets) int i,j,k,l,table_size; int n_speakers = _speakers.size (); + + if (n_speakers == 0) { + return; + } + /* variable length arrays arrived in C99, became optional in C11, and are only planned for C++14. Use alloca which is functionally identical (but uglier to read). @@ -131,10 +136,6 @@ VBAPSpeakers::choose_speaker_triplets(struct ls_triplet_chain **ls_triplets) connections[i] = 0; } - if (n_speakers == 0) { - return; - } - for (i = 0; i < n_speakers; i++) { for (j = i+1; j < n_speakers; j++) { for(k = j+1; k < n_speakers; k++) {