diff options
-rw-r--r-- | tools/ejabberdsql2prosody.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/ejabberdsql2prosody.lua b/tools/ejabberdsql2prosody.lua index 90990b64..6ff8cf19 100644 --- a/tools/ejabberdsql2prosody.lua +++ b/tools/ejabberdsql2prosody.lua @@ -181,8 +181,11 @@ for name, data in pairs(t) do for i=1,#data do local row = data[i]; for j=1,#row do - row[m[j]] = row[j]; - row[j] = nil; + local n = m[j]; + if n then + row[n] = row[j]; + row[j] = nil; + else print("[warning] expected "..#n.." columns for table `"..name.."`, found "..#row); break; end end end end |