1
0
Fork 0

OverlaySelector: don't choke if there are no options

This commit is contained in:
mfranz 2009-01-11 02:42:33 +00:00
parent c6614ce178
commit e96322b351

View file

@ -352,18 +352,21 @@ var OverlaySelector = {
}, },
rescan: func { rescan: func {
me.data = []; me.data = [];
foreach (var file; directory(me.dir)) { var files = directory(me.dir);
if (substr(file, -4) != ".xml") if (size(files)) {
continue; foreach (var file; files) {
var n = io.read_properties(me.dir ~ file); if (substr(file, -4) != ".xml")
var name = n.getNode(me.nameprop, 1).getValue(); continue;
var index = n.getNode(me.sortprop, 1).getValue(); var n = io.read_properties(me.dir ~ file);
if (name == nil or index == nil) var name = n.getNode(me.nameprop, 1).getValue();
continue; var index = n.getNode(me.sortprop, 1).getValue();
append(me.data, [name, index, substr(file, 0, size(file) - 4), me.dir ~ file]); if (name == nil or index == nil)
continue;
append(me.data, [name, index, substr(file, 0, size(file) - 4), me.dir ~ file]);
}
me.data = sort(me.data, func(a, b) num(a[1]) == nil or num(b[1]) == nil
? cmp(a[1], b[1]) : a[1] - b[1]);
} }
me.data = sort(me.data, func(a, b) num(a[1]) == nil or num(b[1]) == nil
? cmp(a[1], b[1]) : a[1] - b[1]);
me.list.removeChildren("value"); me.list.removeChildren("value");
forindex (var i; me.data) forindex (var i; me.data)