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

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -53,7 +53,6 @@ public class AttributedStringPcodeFormatter extends
* Constructor * Constructor
*/ */
public AttributedStringPcodeFormatter() { public AttributedStringPcodeFormatter() {
initPunctuation();
} }
/** /**

View file

@ -206,13 +206,20 @@ public class ClangLayoutController implements LayoutModel, LayoutModelListener {
if (token instanceof ClangFuncNameToken clangFunctionToken) { if (token instanceof ClangFuncNameToken clangFunctionToken) {
Program program = decompilerPanel.getProgram(); Program program = decompilerPanel.getProgram();
Function function = DecompilerUtils.getFunction(program, clangFunctionToken); Function function = DecompilerUtils.getFunction(program, clangFunctionToken);
if (function == null || function instanceof UndefinedFunction) { if (isValidFunction(function)) {
return null; 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);
} }
/** /**

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -16,6 +16,7 @@
package docking.widgets.fieldpanel.field; package docking.widgets.fieldpanel.field;
import java.awt.*; import java.awt.*;
import java.util.Objects;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -94,9 +95,9 @@ public class AttributedString {
throw new NullPointerException("underline color cannot be null when underlining."); throw new NullPointerException("underline color cannot be null when underlining.");
} }
this.icon = icon; this.icon = icon;
this.text = text; this.text = Objects.requireNonNull(text);
this.fontMetrics = fontMetrics; this.fontMetrics = Objects.requireNonNull(fontMetrics);
this.textColor = textColor; this.textColor = Objects.requireNonNull(textColor);
this.isUnderlined = underline; this.isUnderlined = underline;
this.underlineColor = underlineColor; this.underlineColor = underlineColor;
} }