mercurial/commands.py
changeset 5123 f94dbc6c7eaf
parent 5097 73fdc8bd3ed8
child 5124 06154aff2b1a
child 5168 64888ff907f4
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2471,7 +2471,7 @@ def serve(ui, repo, **opts):
     for o in optlist.split():
         if opts[o]:
             parentui.setconfig("web", o, str(opts[o]))
-            if repo.ui != parentui:
+            if (repo is not None) and (repo.ui != parentui):
                 repo.ui.setconfig("web", o, str(opts[o]))
 
     if repo is None and not ui.config("web", "webdir_conf"):