LibGUI: Don't assume GUI::Icon has 16x16 bitmap in AbstractTableView
An empty GUI::Icon would cause the column auto-sizing logic to crash.
This commit is contained in:
parent
0cb6c3c831
commit
5fda8a6c36
Notes:
sideshowbarker
2024-07-18 07:18:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5fda8a6c360
1 changed files with 2 additions and 1 deletions
|
@ -106,7 +106,8 @@ void AbstractTableView::update_column_sizes()
|
|||
auto cell_data = model.index(row, column).data();
|
||||
int cell_width = 0;
|
||||
if (cell_data.is_icon()) {
|
||||
cell_width = cell_data.as_icon().bitmap_for_size(16)->width();
|
||||
if (auto bitmap = cell_data.as_icon().bitmap_for_size(16))
|
||||
cell_width = bitmap->width();
|
||||
} else if (cell_data.is_bitmap()) {
|
||||
cell_width = cell_data.as_bitmap().width();
|
||||
} else if (cell_data.is_valid()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue