mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
ItemListView: return empty string instead of null to prevent the Tooltip from crashing
This commit is contained in:
@@ -493,9 +493,9 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
|
|
||||||
// if we're conditionally showing the tooltip, check to see
|
// if we're conditionally showing the tooltip, check to see
|
||||||
// if we shouldn't show it
|
// if we shouldn't show it
|
||||||
if (val == null) { return null; }
|
if (val == null) { return ""; }
|
||||||
final String text = val.toString();
|
final String text = val.toString();
|
||||||
if (text.isEmpty()) { return null; }
|
if (text.isEmpty()) { return ""; }
|
||||||
|
|
||||||
if (!(renderer instanceof ItemCellRenderer) || !((ItemCellRenderer)renderer).alwaysShowTooltip()) {
|
if (!(renderer instanceof ItemCellRenderer) || !((ItemCellRenderer)renderer).alwaysShowTooltip()) {
|
||||||
// if there's enough room (or there's no value), no tooltip
|
// if there's enough room (or there's no value), no tooltip
|
||||||
@@ -505,7 +505,7 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
final int requiredWidth = cell.getPreferredSize().width;
|
final int requiredWidth = cell.getPreferredSize().width;
|
||||||
final TableColumn tableColumn = this.getColumnModel().getColumn(col);
|
final TableColumn tableColumn = this.getColumnModel().getColumn(col);
|
||||||
if (tableColumn.getWidth() > requiredWidth) {
|
if (tableColumn.getWidth() > requiredWidth) {
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,12 +520,12 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
final int col = columnAtPoint(p);
|
final int col = columnAtPoint(p);
|
||||||
|
|
||||||
if (col >= getColumnCount() || row >= getRowCount()) {
|
if (col >= getColumnCount() || row >= getRowCount()) {
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
final Object val = getValueAt(row, col);
|
final Object val = getValueAt(row, col);
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return getCellTooltip(getCellRenderer(row, col), row, col, val);
|
return getCellTooltip(getCellRenderer(row, col), row, col, val);
|
||||||
|
|||||||
Reference in New Issue
Block a user