summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dyndhcpd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dyndhcpd.c b/dyndhcpd.c
index 82c20ee..873dc75 100644
--- a/dyndhcpd.c
+++ b/dyndhcpd.c
@@ -142,7 +142,7 @@ int main(int argc, char ** argv) {
/* get the domainname */
hp = gethostbyname(hostname);
- if ((domainname = strchr(hp->h_name, '.')) != NULL)
+ if (hp && (domainname = strchr(hp->h_name, '.')) != NULL)
domainname++;
else {
fprintf(stderr, "Could not get domainname, using '" FALLBACKDOMAIN "'\n");