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

@ -70,7 +70,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
/**
* Constructor
*
*
* @param vpanel the byte viewer panel that this component lives in
* @param layoutModel the layout model for this component
* @param model data format model that knows how the data should be displayed
@ -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();
@ -365,7 +368,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
/**
* Set the color for the component that has focus.
*
*
* @param c the color to set
*/
void setCurrentCursorColor(Color c) {
@ -375,7 +378,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
/**
* Set the background color for the line containing the cursor.
*
*
* @param c the color to set
*/
void setCurrentCursorLineColor(Color c) {
@ -384,7 +387,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
/**
* Set the color for showing gaps in indexes.
*
*
* @param c the color to set
*/
void setSeparatorColor(Color c) {
@ -434,7 +437,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
/**
* Set the new group size
*
*
* @param groupSize the group size
* @throws UnsupportedOperationException if model for this view does not support groups
*/
@ -497,7 +500,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
/**
* Set the cursor location; called in response to a location change event
*
*
* @param block the block
* @param index the index
* @param characterOffset the offset into the UI field
@ -657,7 +660,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
/**
* Set the edit mode according to the given param if the model for this view supports editing.
*
*
* @param editMode true means to enable editing, and change the cursor color.
*/
void setEditMode(boolean editMode) {
@ -735,7 +738,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
@Override
public void mouseReleased(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3) {
// hack to make sure that a right-clicked component becomes the active
// hack to make sure that a right-clicked component becomes the active
// component
panel.setCurrentView(ByteViewerComponent.this);
}
@ -855,7 +858,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
}
/**
* Translates a screen/view selection into a byte block model selection
* Translates a screen/view selection into a byte block model selection
* @param fieldSelection a {@link FieldPanel} selection
* @return a {@link ByteBlockSelection}
*/