]> source.dussan.org Git - sonarqube.git/commitdiff
New Issues Page: fix sources
authorStas Vilchik <vilchiks@gmail.com>
Wed, 29 Jan 2014 06:46:22 +0000 (12:46 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 29 Jan 2014 06:46:22 +0000 (12:46 +0600)
sonar-server/src/main/webapp/javascripts/navigator/handlebars-extensions.js
sonar-server/src/main/webapp/javascripts/navigator/issues.js

index 7bc056df41ba27159aa583d8f479b1d3be7e1a18..49b8c14f08c86925fdd15b63f697eebaab2d5e9a 100644 (file)
@@ -86,7 +86,7 @@
       return {
         lineNumber: line,
         code: code,
-        scm: scm[line] ? { author: scm[line][0], date: scm[line][1] } : undefined
+        scm: (scm && scm[line]) ? { author: scm[line][0], date: scm[line][1] } : undefined
       }
     });
 
index b1685f9d6d8ea090bd1d1b1eb5efdb291d4899fe..7e2761ab250749eba28de85cf9c8e876f800ee71 100644 (file)
@@ -182,13 +182,16 @@ jQuery(function() {
 
 
     fetchSource: function(view) {
+      var from = this.model.get('line') - 10,
+          to = this.model.get('line') + 10;
+
       return jQuery.ajax({
         type: 'GET',
         url: baseUrl + '/api/sources/show',
         data: {
           key: this.model.get('component'),
-          from: this.model.get('line') - 10,
-          to: this.model.get('line') + 10,
+          from: from >= 0 ? from : 0,
+          to: to,
           format: 'json'
         }
       }).done(function(r) {