channeld: don't asort(NULL).

It's defined to be nonull:

```
channeld/channeld.c:2381:2: runtime error: null pointer passed as argument 1, which is declared to never be null
/usr/include/stdlib.h:856:3: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior channeld/channeld.c:2381:2 in 
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-04-01 14:13:23 +10:30
parent 37971fb61f
commit b6a3f93b75

View File

@@ -2368,7 +2368,8 @@ static void resend_commitment(struct peer *peer, struct changed_htlc *last)
* is to sort them all into ascending ID order here (we could do
* this when we save them in channel_sending_commit, but older versions
* won't have them sorted in the db, so doing it here is better). */
asort(last, tal_count(last), cmp_changed_htlc_id, NULL);
if (last)
asort(last, tal_count(last), cmp_changed_htlc_id, NULL);
/* BOLT #2:
*