GP-3559 - Fixed NPE

This commit is contained in:
dragonmacher 2023-06-20 13:18:26 -04:00
parent 9d7809902d
commit a4992e431a
2 changed files with 31 additions and 24 deletions

View file

@ -96,6 +96,9 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
}
private String getFieldDescription(FieldLocation fieldLoc, Field field) {
if (field == null) {
return null;
}
ByteBlockInfo info = indexMap.getBlockInfo(fieldLoc.getIndex(), fieldLoc.getFieldNum());
if (info != null) {
String modelName = model.getName();

View file

@ -1300,8 +1300,12 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
super(model, "Decompiler");
// In the decompiler each field represents a line, so make the field description
// simply be the line number
setFieldDescriptionProvider(
(l, f) -> "line " + (l.getIndex().intValue() + 1) + ", " + f.getText());
setFieldDescriptionProvider((l, f) -> {
if (f == null) {
return null;
}
return "line " + (l.getIndex().intValue() + 1) + ", " + f.getText();
});
}
/**