]> git.ipfire.org Git - people/stevee/pypdns.git/commitdiff
Don't crash if, get_domain() gets a non existing domain name.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 24 Sep 2012 18:47:33 +0000 (18:47 +0000)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 27 Sep 2012 17:51:32 +0000 (17:51 +0000)
backend.py

index 4acdd204f93076af277ab0be2ccda8692e20bdb0..3e04d39df5bb93b0c6f6f63130d426481b75f2d6 100644 (file)
@@ -47,9 +47,12 @@ class DNS(object):
        # Get a domain by it's name.
        def get_domain(self, name):
                row = self.db.get("SELECT id FROM domains WHERE name = ?", name)
-               domain = Domain(self, row.id)
 
-               return domain
+               # Only do anything, if there is an existing domain.
+               if row:
+                       domain = Domain(self, row.id)
+
+                       return domain
 
 # Create Domain class.
 """Use query method from database module to get all requested information about our domain."""