summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sort.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sort.c b/src/sort.c
index d571ddf02..6acec070d 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1998,9 +1998,13 @@ keycompare (const struct line *a, const struct line *b)
char const *translate = key->translate;
bool const *ignore = key->ignore;
+ /* Treat field ends before field starts as empty fields. */
+ lima = MAX (texta, lima);
+ limb = MAX (textb, limb);
+
/* Find the lengths. */
- size_t lena = lima <= texta ? 0 : lima - texta;
- size_t lenb = limb <= textb ? 0 : limb - textb;
+ size_t lena = lima - texta;
+ size_t lenb = limb - textb;
/* Actually compare the fields. */