Minty23185Fresh
February 1st, 2019, 23:33
In the masterindex_window.lua file of the CoreRPG ruleset (v3.3.7), at approximately line 239 is the following function:
function clearFilterValues()
if fSharedOnly then
filter_sharedonly.setValue(0);
end
if fName ~= "" then
filter_name.setValue();
end
for kCustomFilter,_ in pairs(aCustomFilters) do
if aCustomFilterValueControls[kCustomFilter] then
aCustomFilterValueControls[kCustomFilter].setValue("");
end
end
end
The "if" statement highlighted in red is not present in the code. Elsewhere in the file there are similar constructs where the simple test is performed prior to attempting to index aCustomFilterValueControls{ }. E.g. ~line 503 in rebuildCustomFilterValues() and ~line 514 of rebuildCustomFilterValues(). So the test has merit.
The issue is, if there are custom filters defined (in aCustomFilters{ }) for a particular field of a recordset, if the corresponding control has not instantiated yet, or was never created, when clearFilterValues() is called then an error will be thrown. And it might not really be an error, just an issue with inconsistent coding.
function clearFilterValues()
if fSharedOnly then
filter_sharedonly.setValue(0);
end
if fName ~= "" then
filter_name.setValue();
end
for kCustomFilter,_ in pairs(aCustomFilters) do
if aCustomFilterValueControls[kCustomFilter] then
aCustomFilterValueControls[kCustomFilter].setValue("");
end
end
end
The "if" statement highlighted in red is not present in the code. Elsewhere in the file there are similar constructs where the simple test is performed prior to attempting to index aCustomFilterValueControls{ }. E.g. ~line 503 in rebuildCustomFilterValues() and ~line 514 of rebuildCustomFilterValues(). So the test has merit.
The issue is, if there are custom filters defined (in aCustomFilters{ }) for a particular field of a recordset, if the corresponding control has not instantiated yet, or was never created, when clearFilterValues() is called then an error will be thrown. And it might not really be an error, just an issue with inconsistent coding.