From 43656559b0fa0431a072156c16209728d1f47dd7 Mon Sep 17 00:00:00 2001 From: Erick Aguiar Date: Thu, 14 Nov 2019 16:02:15 -0300 Subject: [PATCH] handling match in empty string The previous fix (#26) wasn't handling the return of the match function, witch is null when the string is empty. --- lib/websocket/http_parser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/websocket/http_parser.js b/lib/websocket/http_parser.js index d562772..1396656 100644 --- a/lib/websocket/http_parser.js +++ b/lib/websocket/http_parser.js @@ -96,9 +96,9 @@ HttpParser.METHODS = { 32: 'UNLINK' }; -var VERSION = (process.version || '') - .match(/[0-9]+/g) - .map(function(n) { return parseInt(n, 10) }); +var VERSION = process.version + ? process.version.match(/[0-9]+/g).map(function(n) { return parseInt(n, 10) }) + : []; if (VERSION[0] === 0 && VERSION[1] === 12) { HttpParser.METHODS[16] = 'REPORT';