summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/tdb/tdb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index c469436f75..a754c583e6 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -575,9 +575,13 @@ char *tdb_error(TDB_CONTEXT *tdb)
{TDB_ERR_OOM, "Out of memory"},
{TDB_ERR_EXISTS, "Record exists"},
{-1, NULL}};
- for (i=0;emap[i].estring;i++) {
+ if (tdb != NULL) {
+ for (i=0;emap[i].estring;i++) {
if (tdb->ecode == emap[i].ecode) return emap[i].estring;
- }
+ }
+ } else {
+ return "Invalid tdb context";
+ }
return "Invalid error code";
}