From 98beb6dbd89263256e1a89eb3864054ec2b417ce Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 18 Nov 2016 20:20:46 -0500 Subject: [PATCH] Check length before assigning to a return tag (#606) --- lib/infer/return.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/infer/return.js b/lib/infer/return.js index 27f7d9b..790aa7a 100644 --- a/lib/infer/return.js +++ b/lib/infer/return.js @@ -32,7 +32,7 @@ module.exports = function () { fn.returnType && fn.returnType.typeAnnotation) { var returnType = flowDoctrine(fn.returnType.typeAnnotation); - if (comment.returns) { + if (comment.returns && comment.returns.length > 0) { comment.returns[0].type = returnType; } else { comment.returns = [{