From 6dfa6a1f6b41f0822eb27fc2019722fb37bff088 Mon Sep 17 00:00:00 2001 From: Sahar Jafari Date: Fri, 18 Dec 2015 10:20:26 -0800 Subject: [PATCH] [header] Don't assign preview when there is an error in yaml Fixes https://github.com/swagger-api/swagger-editor/issues/693. --- app/scripts/controllers/header.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/scripts/controllers/header.js b/app/scripts/controllers/header.js index af588dfd703..7fd4fe4f8df 100644 --- a/app/scripts/controllers/header.js +++ b/app/scripts/controllers/header.js @@ -163,6 +163,11 @@ SwaggerEditor.controller('HeaderCtrl', function HeaderCtrl($scope, $modal, var yaml = $rootScope.editorValue; YAML.load(yaml, function (error, json) { + // Don't assign if there is an error + if (error) { + return; + } + // if `yaml` is JSON, convert it to YAML var jsonParseError = null; try {