Merge remote-tracking branch

'origin/GP-5346-dragonmacher-decompiler-function-color-bug'
(Closes #7453)
This commit is contained in:
Ryan Kurtz 2025-03-06 09:25:23 -05:00
commit ec743e0280
3 changed files with 20 additions and 13 deletions

View file

@ -53,7 +53,6 @@ public class AttributedStringPcodeFormatter extends
* Constructor
*/
public AttributedStringPcodeFormatter() {
initPunctuation();
}
/**

View file

@ -206,14 +206,21 @@ 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();
return symbolInspector.getColor(symbol);
tokenColor = symbolInspector.getColor(symbol);
}
}
if (tokenColor != null) {
return tokenColor;
}
return syntaxColor[ClangToken.ERROR_COLOR];
}
private boolean isValidFunction(Function f) {
return f != null && !(f instanceof UndefinedFunction);
}
/**
* Update to the current Decompiler display options

View file

@ -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;
}