Return empty table instead of error if load is called with empty params

squeeze-backports
Victor Seva 13 years ago
parent bed951c459
commit 0cb72f63e7

@ -18,14 +18,14 @@ NGCPDomainPrefs_MT = { __index = NGCPDomainPrefs }
function NGCPDomainPrefs:caller_load(uuid) function NGCPDomainPrefs:caller_load(uuid)
if not uuid then if not uuid then
error("uuid is empty") return {}
end end
return NGCPDomainPrefs._load(self,"caller",uuid) return NGCPDomainPrefs._load(self,"caller",uuid)
end end
function NGCPDomainPrefs:callee_load(uuid) function NGCPDomainPrefs:callee_load(uuid)
if not uuid then if not uuid then
error("uuid is empty") return {}
end end
return NGCPDomainPrefs._load(self,"callee",uuid) return NGCPDomainPrefs._load(self,"callee",uuid)
end end

@ -18,14 +18,14 @@ NGCPUserPrefs_MT = { __index = NGCPUserPrefs }
function NGCPUserPrefs:caller_load(uuid) function NGCPUserPrefs:caller_load(uuid)
if not uuid then if not uuid then
error("uuid is empty") return {}
end end
return NGCPUserPrefs._load(self,"caller",uuid) return NGCPUserPrefs._load(self,"caller",uuid)
end end
function NGCPUserPrefs:callee_load(uuid) function NGCPUserPrefs:callee_load(uuid)
if not uuid then if not uuid then
error("uuid is empty") return {}
end end
return NGCPUserPrefs._load(self,"callee",uuid) return NGCPUserPrefs._load(self,"callee",uuid)
end end

@ -72,12 +72,12 @@ TestNGCPDomainPrefs = {} --class
function TestNGCPDomainPrefs:test_caller_load_empty() function TestNGCPDomainPrefs:test_caller_load_empty()
assertTrue(self.d.config) assertTrue(self.d.config)
assertError(self.d.caller_load, nil) assertEquals(self.d:caller_load(), {})
end end
function TestNGCPDomainPrefs:test_callee_load_empty() function TestNGCPDomainPrefs:test_callee_load_empty()
assertTrue(self.d.config) assertTrue(self.d.config)
assertError(self.d.callee_load, nil) assertEquals(self.d:callee_load(), {})
end end
function TestNGCPDomainPrefs:test_caller_load() function TestNGCPDomainPrefs:test_caller_load()

@ -72,12 +72,12 @@ TestNGCPPeerPrefs = {} --class
function TestNGCPPeerPrefs:test_caller_load_empty() function TestNGCPPeerPrefs:test_caller_load_empty()
assertTrue(self.d.config) assertTrue(self.d.config)
assertEquals(self.d.caller_load(), nil) assertEquals(self.d:caller_load(), {})
end end
function TestNGCPPeerPrefs:test_callee_load_empty() function TestNGCPPeerPrefs:test_callee_load_empty()
assertTrue(self.d.config) assertTrue(self.d.config)
assertEquals(self.d.callee_load(), nil) assertEquals(self.d:callee_load(), {})
end end
function TestNGCPPeerPrefs:test_caller_load() function TestNGCPPeerPrefs:test_caller_load()

@ -67,12 +67,12 @@ TestNGCPUserPrefs = {} --class
function TestNGCPUserPrefs:test_caller_load_empty() function TestNGCPUserPrefs:test_caller_load_empty()
assertTrue(self.d.config) assertTrue(self.d.config)
assertError(self.d.caller_load, nil) assertEquals(self.d:caller_load(), {})
end end
function TestNGCPUserPrefs:test_callee_load_empty() function TestNGCPUserPrefs:test_callee_load_empty()
assertTrue(self.d.config) assertTrue(self.d.config)
assertError(self.d.callee_load, nil) assertEquals(self.d:callee_load(), {})
end end
function TestNGCPUserPrefs:test_init() function TestNGCPUserPrefs:test_init()

Loading…
Cancel
Save