More code fixes

This commit is contained in:
TheStonedTurtle
2019-05-11 10:11:24 -07:00
parent eaae5b4067
commit 7b45cbe348
2 changed files with 16 additions and 3 deletions

View File

@@ -76,7 +76,7 @@ public class TableComponent implements LayoutableRenderableEntity
for (TableRow row : this.rows) for (TableRow row : this.rows)
{ {
height += displayRow(graphics, row, height, columnWidths, metrics); height = displayRow(graphics, row, height, columnWidths, metrics);
} }
graphics.translate(-preferredLocation.x, -preferredLocation.y); graphics.translate(-preferredLocation.x, -preferredLocation.y);
@@ -99,7 +99,13 @@ public class TableComponent implements LayoutableRenderableEntity
int y = startingRowHeight; int y = startingRowHeight;
final TableElement cell = elements.get(i); final TableElement cell = elements.get(i);
final String[] lines = lineBreakText(cell.getContent(), columnWidths[i], metrics); final String content = cell.getContent();
if (content == null)
{
continue;
}
final String[] lines = lineBreakText(content, columnWidths[i], metrics);
final TableAlignment alignment = getCellAlignment(row, i); final TableAlignment alignment = getCellAlignment(row, i);
final Color color = getCellColor(row, i); final Color color = getCellColor(row, i);
@@ -151,6 +157,11 @@ public class TableComponent implements LayoutableRenderableEntity
{ {
final TableElement ele = elements.get(col); final TableElement ele = elements.get(col);
final String cell = ele.getContent(); final String cell = ele.getContent();
if (cell == null)
{
continue;
}
final int cellWidth = getTextWidth(metrics, cell); final int cellWidth = getTextWidth(metrics, cell);
maxtextw[col] = Math.max(maxtextw[col], cellWidth); maxtextw[col] = Math.max(maxtextw[col], cellWidth);

View File

@@ -25,6 +25,7 @@
package net.runelite.client.ui.overlay.components.table; package net.runelite.client.ui.overlay.components.table;
import java.awt.Color; import java.awt.Color;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@@ -35,5 +36,6 @@ public class TableRow
{ {
Color rowColor; Color rowColor;
TableAlignment rowAlignment; TableAlignment rowAlignment;
List<TableElement> elements; @Builder.Default
List<TableElement> elements = new ArrayList<>();
} }