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)
if not uuid then
error("uuid is empty")
return {}
end
return NGCPDomainPrefs._load(self,"caller",uuid)
end
function NGCPDomainPrefs:callee_load(uuid)
if not uuid then
error("uuid is empty")
return {}
end
return NGCPDomainPrefs._load(self,"callee",uuid)
end

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

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

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

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

Loading…
Cancel
Save