]> source.dussan.org Git - archiva.git/commitdiff
prevent js npe
authorOlivier Lamy <olamy@apache.org>
Tue, 5 Jun 2012 21:44:13 +0000 (21:44 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 5 Jun 2012 21:44:13 +0000 (21:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1346613 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html

index 31f1394ee9262e2d8d6ec2b384543a103ffa7d70..13d048086349b597cc370043bdb64f297110080e 100644 (file)
@@ -895,7 +895,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
       }
       return projectVersionMetadata;
     }
-    return null;
+    return new ProjectVersionMetadata();
   }
 
   MavenFacet=function(packaging,parent){
index 2a656b4b17605dd30f78616036230088b5a16f2b..35a0bf1ca9b5ff7f318ecacd526e78e9cb4f5cfe 100644 (file)
                 </tr>
                 <tr>
                   <th>${$.i18n.prop('browse.artifact.packaging')}</th>
-                  <td>${projectVersionMetadata.mavenFacet.packaging}</td>
-                </tr>
-                {{if projectVersionMetadata.mavenFacet.parent }}
-                <tr>
-                  <th>${$.i18n.prop('browse.artifact.parent')}</th>
-                  <td>
-                    <a href="#" data-bind="click: displayParent">
-                    ${projectVersionMetadata.mavenFacet.parent.groupId}:${projectVersionMetadata.mavenFacet.parent.artifactId}:${projectVersionMetadata.mavenFacet.parent.version}
-                    </a>
-                  </td>
+                  {{if projectVersionMetadata.mavenFacet}}
+                    <td>${projectVersionMetadata.mavenFacet.packaging}</td>
+                  {{else}}
+                    <td></td>
+                  {{/if}}
                 </tr>
+                {{if projectVersionMetadata.mavenFacet}}
+                  {{if projectVersionMetadata.mavenFacet.parent }}
+                  <tr>
+                    <th>${$.i18n.prop('browse.artifact.parent')}</th>
+                    <td>
+                      <a href="#" data-bind="click: displayParent">
+                      ${projectVersionMetadata.mavenFacet.parent.groupId}:${projectVersionMetadata.mavenFacet.parent.artifactId}:${projectVersionMetadata.mavenFacet.parent.version}
+                      </a>
+                    </td>
+                  </tr>
+                  {{/if}}
                 {{/if}}
               </tbody>
             </table>