From: Stefan Schantl Date: Mon, 24 Sep 2012 18:47:33 +0000 (+0000) Subject: Don't crash if, get_domain() gets a non existing domain name. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d267bece099c7a5a787b7c3dc9167555a30b7bb9;p=people%2Fstevee%2Fpypdns.git Don't crash if, get_domain() gets a non existing domain name. --- diff --git a/backend.py b/backend.py index 4acdd20..3e04d39 100644 --- a/backend.py +++ b/backend.py @@ -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."""