fix NPE rendering reference

This commit is contained in:
Grahame Grieve 2024-11-22 22:50:59 +11:00
parent 44189e9bde
commit aa128248f6
1 changed files with 16 additions and 12 deletions

View File

@ -846,22 +846,26 @@ public abstract class ResourceRenderer extends DataRenderer {
if (!Utilities.noString(r.getId())) { if (!Utilities.noString(r.getId())) {
if (!context.isSecondaryLang()) { if (!context.isSecondaryLang()) {
String sid = r.getScopedId(); String sid = r.getScopedId();
if (!context.hasAnchor(sid)) { if (sid != null) {
context.addAnchor(sid); if (!context.hasAnchor(sid)) {
x.an(context.prefixAnchor(sid)); context.addAnchor(sid);
} x.an(context.prefixAnchor(sid));
sid = "hc"+sid; }
if (!context.hasAnchor(sid)) { sid = "hc"+sid;
context.addAnchor(sid); if (!context.hasAnchor(sid)) {
x.an(context.prefixAnchor(sid)); context.addAnchor(sid);
x.an(context.prefixAnchor(sid));
}
} }
} }
if (context.getLocale() != null) { if (context.getLocale() != null) {
String langSuffix = "-"+context.getLocale().toLanguageTag(); String langSuffix = "-"+context.getLocale().toLanguageTag();
String sid = r.getScopedId()+langSuffix; if (r.getScopedId() != null) {
if (!context.hasAnchor(sid)) { String sid = r.getScopedId()+langSuffix;
context.addAnchor(sid); if (!context.hasAnchor(sid)) {
x.an(context.prefixAnchor(sid)); context.addAnchor(sid);
x.an(context.prefixAnchor(sid));
}
} }
} }
} }