This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit b3c2931d58f7e74123c83e823654448a4d5395cd
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Fri Oct 27 16:26:12 2023 +0100
sort - handle if fields are not all there
---
src/efm/sort.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/efm/sort.c b/src/efm/sort.c
index 3a87721..3250db4 100644
--- a/src/efm/sort.c
+++ b/src/efm/sort.c
@@ -64,7 +64,6 @@ _sort_str_field(const Cmd *c1, const Cmd *c2,
field1 = cmd_key_find(c1, field);
if (!field1) return 0;
-
field2 = cmd_key_find(c2, field);
if (!field2) return 0;
@@ -72,8 +71,10 @@ _sort_str_field(const Cmd *c1, const Cmd *c2,
if (!res)
{ // they are the same string! use pure filename path as it's unique
path1 = cmd_key_find(c1, "path");
+ if (!path1) return 0;
path2 = cmd_key_find(c2, "path");
- res = cmpfn(path1, path2);
+ if (!path2) return 0;
+ res = cmpfn(path1, path2);
if (!res) return strcmp(path1, path2);
return res;
}
@@ -89,7 +90,6 @@ _sort_num_field(const Cmd *c1, const Cmd *c2, const char *field)
// get field and convert to ulonglong
f = cmd_key_find(c1, field);
if (f) field1 = strtoull(f, NULL, 10);
-
// get field and convert to ulonglong
f = cmd_key_find(c2, field);
if (f) field2 = strtoull(f, NULL, 10);
@@ -97,7 +97,9 @@ _sort_num_field(const Cmd *c1, const Cmd *c2, const char *field)
if (field1 == field2)
{ // they are the same string! use pure filename path as it's unique
path1 = cmd_key_find(c1, "path");
+ if (!path1) return 0;
path2 = cmd_key_find(c2, "path");
+ if (!path2) return 0;
return strcmp(path1, path2);
}
// sort result
@@ -122,7 +124,6 @@ _sort_label(const Cmd *c1, const Cmd *c2,
// get a label instead of filename path element if available
path1 = cmd_key_find(c1, "label");
if (!path1) path1 = cmd_key_find(c1, "path");
-
// get a label instead of filename path element if available
path2 = cmd_key_find(c2, "label");
if (!path2) path2 = cmd_key_find(c2, "path");
@@ -131,8 +132,10 @@ _sort_label(const Cmd *c1, const Cmd *c2,
if (!res)
{ // they are the same string! use pure filename path as it's unique
path1 = cmd_key_find(c1, "path");
+ if (!path1) return 0;
path2 = cmd_key_find(c2, "path");
- res = cmpfn(path1, path2);
+ if (!path2) return 0;
+ res = cmpfn(path1, path2);
if (!res) return strcmp(path1, path2);
return res;
}
@@ -150,7 +153,6 @@ _sort_mode(const Cmd *c1, const Cmd *c2)
f = cmd_key_find(c1, "mode");
if (f) mode1 = strtoull(f, NULL, 16);
_str_mode(mode1, m1);
-
// get mdoe and generate mode string
f = cmd_key_find(c2, "mode");
if (f) mode2 = strtoull(f, NULL, 16);
@@ -171,7 +173,6 @@ _sort_dir_not_dir(const Cmd *c1, const Cmd *c2)
if ((type1) && (!strcmp(type1, "link")))
type1 = cmd_key_find(c1, "link-type");
if (!type1) type1 = "file";
-
type2 = cmd_key_find(c2, "type");
if ((type2) && (!strcmp(type2, "link")))
type2 = cmd_key_find(c2, "link-type");
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.