Changeset 787


Ignore:
Timestamp:
Feb 5, 2011, 9:25:06 PM (9 years ago)
Author:
gav
Message:

Add some null checking to AssetService.getAssemblies and assetTreeCompact template.

Location:
branches/features/taskProcedureRework/grails-app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/features/taskProcedureRework/grails-app/services/AssetService.groovy

    r776 r787  
    3030    * @returns A list of the assemblies.
    3131    */
    32     def getAssemblies(Asset asset) {
     32    def getAssemblies(asset) {
    3333        def assemblies = []
     34        if(!(asset instanceof Asset))
     35            return assemblies
    3436        // Database efficiency:
    3537        // The asset is configured to batch fetch assetSubItems which
  • branches/features/taskProcedureRework/grails-app/views/shared/_assetTreeCompact.gsp

    r780 r787  
     1
     2<%--  Fetch to prevent lazy initialization error.  --%>
     3<% assetInstance = Asset.read(assetInstance?.id)%>
    14
    25<div class="static_tree" >
    3     ${assetInstance.encodeAsHTML()}
     6    ${assetInstance?.encodeAsHTML()}
    47    <ul>
    5     <g:each var="assetSubItem1" in="${assetInstance.assetSubItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">
     8    <g:each var="assetSubItem1" in="${assetInstance?.assetSubItems?.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">
    69        <li>
    710            ${assetSubItem1?.encodeAsHTML()}
Note: See TracChangeset for help on using the changeset viewer.