diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/pcode/AttributedStringPcodeFormatter.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/pcode/AttributedStringPcodeFormatter.java index 02cf133236..56ce5de588 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/pcode/AttributedStringPcodeFormatter.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/pcode/AttributedStringPcodeFormatter.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -53,7 +53,6 @@ public class AttributedStringPcodeFormatter extends * Constructor */ public AttributedStringPcodeFormatter() { - initPunctuation(); } /** diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/ClangLayoutController.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/ClangLayoutController.java index 2a5d2a7800..42df81b467 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/ClangLayoutController.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/ClangLayoutController.java @@ -206,13 +206,20 @@ public class ClangLayoutController implements LayoutModel, LayoutModelListener { if (token instanceof ClangFuncNameToken clangFunctionToken) { Program program = decompilerPanel.getProgram(); Function function = DecompilerUtils.getFunction(program, clangFunctionToken); - if (function == null || function instanceof UndefinedFunction) { - return null; + if (isValidFunction(function)) { + Symbol symbol = function.getSymbol(); + tokenColor = symbolInspector.getColor(symbol); } - Symbol symbol = function.getSymbol(); - return symbolInspector.getColor(symbol); } - return tokenColor; + + if (tokenColor != null) { + return tokenColor; + } + return syntaxColor[ClangToken.ERROR_COLOR]; + } + + private boolean isValidFunction(Function f) { + return f != null && !(f instanceof UndefinedFunction); } /** diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/field/AttributedString.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/field/AttributedString.java index 777741dc67..3135744173 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/field/AttributedString.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/field/AttributedString.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,6 +16,7 @@ package docking.widgets.fieldpanel.field; import java.awt.*; +import java.util.Objects; import javax.swing.Icon; import javax.swing.JComponent; @@ -94,9 +95,9 @@ public class AttributedString { throw new NullPointerException("underline color cannot be null when underlining."); } this.icon = icon; - this.text = text; - this.fontMetrics = fontMetrics; - this.textColor = textColor; + this.text = Objects.requireNonNull(text); + this.fontMetrics = Objects.requireNonNull(fontMetrics); + this.textColor = Objects.requireNonNull(textColor); this.isUnderlined = underline; this.underlineColor = underlineColor; }