diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-10-14 18:50:34 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-10-14 19:49:57 +0300 |
commit | d15bdd8d9177e0b74a5f7a675ad09ea15a04bc86 (patch) | |
tree | ed754890d2e3026e7245f04da5dbcf03465b4625 /acf2/persistence | |
parent | 4fd1cf422e0438d65354d4c15ea0e1b52d6af2ad (diff) | |
download | acf2-d15bdd8d9177e0b74a5f7a675ad09ea15a04bc86.tar.bz2 acf2-d15bdd8d9177e0b74a5f7a675ad09ea15a04bc86.tar.xz |
augeas backend: do not crash if entire file not modeled
Diffstat (limited to 'acf2/persistence')
-rw-r--r-- | acf2/persistence/backends/augeas.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/acf2/persistence/backends/augeas.lua b/acf2/persistence/backends/augeas.lua index 620a393..7078fe9 100644 --- a/acf2/persistence/backends/augeas.lua +++ b/acf2/persistence/backends/augeas.lua @@ -106,12 +106,14 @@ function backend:set(mods) if #self.aug:match(mpath) == 0 then local function order(path) - return topology('/augeas'..path).order + local top = topology('/augeas'..path) + return top and top.order end local ord = order(pth.join('/', unpack(path))) for _, sibling in ipairs(self.aug:match(pth.parent(mpath)..'/*')) do - if order(strip_name(sibling):sub(7, -1)) > ord then + local sord = order(strip_name(sibling):sub(7, -1)) + if sord and sord > ord then self.aug:insert(sibling, pth.name(mpath), true) break end |