diff --git a/nano.js b/nano.js
index <HASH>..<HASH> 100644
--- a/nano.js
+++ b/nano.js
@@ -556,7 +556,7 @@ module.exports = exports = nano = function database_module(cfg) {
                      };
 
   // does the user want a database, or nano?
-  if(!_.isEmpty(path.pathname.split('/')[1])) {
+  if(path.pathname && !_.isEmpty(path.pathname.split('/')[1])) {
     db = path.pathname.split('/')[1];
     cfg.url = path.protocol + '//' + path.host; // reset url
     return document_module(db);
make sure that we've parsed out a pathname before we split it.