Skip to content

Commit ffc8da5

Browse files
don't try to sort 18446744073709551615 entries if non exist
1 parent 181150b commit ffc8da5

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

common/hekate.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,16 @@ namespace Hekate {
119119
break;
120120
}
121121

122-
/* Reorder ini files by ASCII ordering. */
123-
char temp[0x100];
124-
for (size_t i = 0; i < count - 1 ; i++) {
125-
for (size_t j = i + 1; j < count; j++) {
126-
if (std::strcmp(dir_entries[i], dir_entries[j]) > 0) {
127-
std::strcpy(temp, dir_entries[i]);
128-
std::strcpy(dir_entries[i], dir_entries[j]);
129-
std::strcpy(dir_entries[j], temp);
122+
if (count > 1) {
123+
/* Reorder ini files by ASCII ordering. */
124+
char temp[0x100];
125+
for (size_t i = 0; i < count - 1 ; i++) {
126+
for (size_t j = i + 1; j < count; j++) {
127+
if (std::strcmp(dir_entries[i], dir_entries[j]) > 0) {
128+
std::strcpy(temp, dir_entries[i]);
129+
std::strcpy(dir_entries[i], dir_entries[j]);
130+
std::strcpy(dir_entries[j], temp);
131+
}
130132
}
131133
}
132134
}

0 commit comments

Comments
 (0)