Merge remote-tracking branch 'origin/patch'

This commit is contained in:
Ryan Kurtz
2026-07-21 15:41:38 -04:00
2 changed files with 14 additions and 6 deletions

View File

@@ -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.
@@ -19,6 +19,7 @@ import java.awt.*;
import java.awt.event.FocusListener;
import java.text.BreakIterator;
import java.util.Locale;
import java.util.Objects;
import javax.accessibility.*;
import javax.swing.JComponent;
@@ -49,11 +50,12 @@ public class AccessibleField extends AccessibleContext
* @param bounds the bounds of the field relative to the field panel.
*/
public AccessibleField(Field field, JComponent parent, int indexInParent, Rectangle bounds) {
Objects.requireNonNull(field);
this.field = field;
this.parent = parent;
this.indexInParent = indexInParent;
this.locale = parent.getLocale();
this.boundsInParent = bounds;
this.boundsInParent = bounds != null ? bounds : new Rectangle(0, 0, 0, 0);
setAccessibleName("Field");
}

View File

@@ -27,6 +27,7 @@ import javax.accessibility.*;
import docking.widgets.EventTrigger;
import docking.widgets.fieldpanel.field.Field;
import docking.widgets.fieldpanel.support.*;
import ghidra.util.Msg;
/**
* Contains all the code for implementing the AccessibleFieldPanel which is an inner class in
@@ -227,8 +228,9 @@ public class AccessibleFieldPanelDelegate {
*/
public AccessibleField getAccessibleField(FieldLocation loc) {
AccessibleLayout accessibleLayout = getAccessibleLayout(loc.getIndex());
int fieldNum = loc.getFieldNum();
if (accessibleLayout != null) {
return getAccessibleField(accessibleLayout.getStartingFieldNum() + loc.getFieldNum());
return getAccessibleField(accessibleLayout.getStartingFieldNum() + fieldNum);
}
LayoutModel layoutModel = panel.getLayoutModel();
@@ -236,8 +238,12 @@ public class AccessibleFieldPanelDelegate {
if (layout == null) {
return null;
}
Field field = layout.getField(loc.getFieldNum());
return new AccessibleField(field, panel, loc.getFieldNum(), null);
Field field = layout.getField(fieldNum);
if (field == null) {
Msg.warn(this, "Can't find field for given FieldLocation, loc = " + loc);
return null;
}
return new AccessibleField(field, panel, fieldNum, null);
}
private AccessibleLayout getAccessibleLayout(BigInteger index) {