Fix logic in project's file insertion
The function "file_search" in core.init was sometimes giving a wrong index value, off by one. The problem happened for example when the entry to search was "less than" the first entry, the function returned a value of two instead of one as expected. The bug was easily observed creating a new directory with a name that comes as the first in alphabetical order within the project.
This commit is contained in:
parent
b918f248cb
commit
5f215ccbd4
|
@ -199,12 +199,12 @@ local function file_search(files, info)
|
||||||
inf = curr
|
inf = curr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
repeat
|
while inf <= sup and not system.path_compare(filename, type, files[inf].filename, files[inf].type) do
|
||||||
if files[inf].filename == filename then
|
if files[inf].filename == filename then
|
||||||
return inf, true
|
return inf, true
|
||||||
end
|
end
|
||||||
inf = inf + 1
|
inf = inf + 1
|
||||||
until inf > sup or system.path_compare(filename, type, files[inf].filename, files[inf].type)
|
end
|
||||||
return inf, false
|
return inf, false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue