summaryrefslogtreecommitdiff
path: root/src/sort.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sort.c')
-rw-r--r--src/sort.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sort.c b/src/sort.c
index 493e7f173..2593a2a6e 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
+#include <assert.h>
#include "system.h"
#include "argmatch.h"
#include "error.h"
@@ -4243,6 +4244,10 @@ main (int argc, char **argv)
char const *optarg1 = argv[optind++];
s = parse_field_count (optarg1 + 1, &key->eword,
N_("invalid number after '-'"));
+ /* When called with a non-NULL message ID,
+ parse_field_count cannot return NULL. Tell static
+ analysis tools that dereferencing S is safe. */
+ assert (s);
if (*s == '.')
s = parse_field_count (s + 1, &key->echar,
N_("invalid number after '.'"));