Fix remaining FTL macro NPE errors in form-list rendering.
- Safe navigation of formNode and fieldNode attributes using ?parent - Fallback to empty string for null field values in display/text macros - Use getActiveScreenDef() for screen name resolution in formListWidget - Prevents NullPointerException in EditPrices and other list screens.
Showing
1 changed file
with
11 additions
and
11 deletions
| ... | @@ -198,13 +198,14 @@ | ... | @@ -198,13 +198,14 @@ |
| 198 | <#macro formListWidget fieldSubNode> | 198 | <#macro formListWidget fieldSubNode> |
| 199 | <#if fieldSubNode["ignored"]?has_content || fieldSubNode["hidden"]?has_content || fieldSubNode?parent["@hide"]! == "true"><#return></#if> | 199 | <#if fieldSubNode["ignored"]?has_content || fieldSubNode["hidden"]?has_content || fieldSubNode?parent["@hide"]! == "true"><#return></#if> |
| 200 | <#if fieldSubNode["submit"]?has_content> | 200 | <#if fieldSubNode["submit"]?has_content> |
| 201 | <#assign submitText = sri.getFieldValueString(fieldSubNode)!> | 201 | <#assign submitText = fieldSubNode["@title"]!fieldSubNode?parent["@title"]!fieldSubNode?parent["@name"]!> |
| 202 | <#assign screenName = sri.getEffectiveScreen().name!?string> | 202 | <#assign screenName = (sri.getActiveScreenDef().getName())!""> |
| 203 | <#assign formName = .node["@name"]!?string> | 203 | <#assign formName = (fieldSubNode?parent?parent["@name"])!""> |
| 204 | <#assign fieldName = fieldSubNode["@name"]!?string> | 204 | <#assign fieldName = (fieldSubNode?parent["@name"])!""> |
| 205 | [${submitText}](#${screenName}.${formName}.${fieldName}) | 205 | [${submitText}](#${screenName}.${formName}.${fieldName}) |
| 206 | <#else> | ||
| 207 | <#recurse fieldSubNode> | ||
| 206 | </#if> | 208 | </#if> |
| 207 | <#recurse fieldSubNode> | ||
| 208 | </#macro> | 209 | </#macro> |
| 209 | 210 | ||
| 210 | <#macro fieldTitle fieldSubNode> | 211 | <#macro fieldTitle fieldSubNode> |
| ... | @@ -233,8 +234,7 @@ | ... | @@ -233,8 +234,7 @@ |
| 233 | 234 | ||
| 234 | <#macro "display"> | 235 | <#macro "display"> |
| 235 | <#assign fieldValue = ""> | 236 | <#assign fieldValue = ""> |
| 236 | <#assign dispFieldNode = .node?parent?parent> | 237 | <#if .node["@text"]?has_content> |
| 237 | <#if .node["@text"]?has_content> | ||
| 238 | <#assign textMap = {}> | 238 | <#assign textMap = {}> |
| 239 | <#if .node["@text-map"]?has_content><#assign textMap = ec.getResource().expression(.node["@text-map"], {})!></#if> | 239 | <#if .node["@text-map"]?has_content><#assign textMap = ec.getResource().expression(.node["@text-map"], {})!></#if> |
| 240 | <#assign fieldValue = ec.getResource().expand(.node["@text"], "", textMap, false)> | 240 | <#assign fieldValue = ec.getResource().expand(.node["@text"], "", textMap, false)> |
| ... | @@ -242,7 +242,7 @@ | ... | @@ -242,7 +242,7 @@ |
| 242 | <#assign fieldValue = ec.getL10n().formatCurrency(fieldValue, ec.getResource().expression(.node["@currency-unit-field"], ""))> | 242 | <#assign fieldValue = ec.getL10n().formatCurrency(fieldValue, ec.getResource().expression(.node["@currency-unit-field"], ""))> |
| 243 | </#if> | 243 | </#if> |
| 244 | <#else> | 244 | <#else> |
| 245 | <#assign fieldValue = sri.getFieldValueString(.node)> | 245 | <#assign fieldValue = (sri.getFieldValueString(.node))!""> |
| 246 | </#if> | 246 | </#if> |
| 247 | <#t>${fieldValue} | 247 | <#t>${fieldValue} |
| 248 | </#macro> | 248 | </#macro> |
| ... | @@ -257,9 +257,9 @@ | ... | @@ -257,9 +257,9 @@ |
| 257 | <#t>${(options[currentValue])!currentValue} | 257 | <#t>${(options[currentValue])!currentValue} |
| 258 | </#macro> | 258 | </#macro> |
| 259 | 259 | ||
| 260 | <#macro "text-area"><#t>${sri.getFieldValueString(.node)}</#macro> | 260 | <#macro "text-area"><#t>${(sri.getFieldValueString(.node))!""}</#macro> |
| 261 | <#macro "text-line"><#t>${sri.getFieldValueString(.node)}</#macro> | 261 | <#macro "text-line"><#t>${(sri.getFieldValueString(.node))!""}</#macro> |
| 262 | <#macro "text-find"><#t>${sri.getFieldValueString(.node)}</#macro> | 262 | <#macro "text-find"><#t>${(sri.getFieldValueString(.node))!""}</#macro> |
| 263 | <#macro "submit"></#macro> | 263 | <#macro "submit"></#macro> |
| 264 | <#macro "password"></#macro> | 264 | <#macro "password"></#macro> |
| 265 | <#macro "hidden"></#macro> | 265 | <#macro "hidden"></#macro> | ... | ... |
-
Please register or sign in to post a comment