From b6772c1fde5878fdb492aad8b4f9c0bc10284a29 Mon Sep 17 00:00:00 2001
From: Xu Cheng <xucheng@me.com>
Date: Mon, 18 Jul 2016 00:03:56 +0800
Subject: [PATCH] create: path.version may be nil

Fixes https://github.com/Homebrew/homebrew-core/issues/3067.
---
 Library/Homebrew/cmd/create.rb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Library/Homebrew/cmd/create.rb b/Library/Homebrew/cmd/create.rb
index ac936818a7..ed71a6d398 100644
--- a/Library/Homebrew/cmd/create.rb
+++ b/Library/Homebrew/cmd/create.rb
@@ -110,8 +110,7 @@ class FormulaCreator
       when %r{github\.com/\S+/(\S+)/archive/}
         @name = $1
       else
-        /(.*?)[-_.]?#{Regexp.escape(path.version)}/.match path.basename
-        @name = $1
+        @name = path.basename.to_s[/(.*?)[-_.]?#{Regexp.escape(path.version.to_s)}/, 1]
       end
     end
     update_path
-- 
GitLab