1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(table): set row count to zero (#4937)

This commit is contained in:
PGNetHun 2023-12-06 09:00:09 +01:00 committed by GitHub
parent accd0cb519
commit f6eefe8eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -218,7 +218,7 @@ void lv_table_set_row_count(lv_obj_t * obj, uint32_t row_cnt)
uint32_t new_cell_cnt = table->col_cnt * table->row_cnt;
uint32_t i;
for(i = new_cell_cnt; i < old_cell_cnt; i++) {
if(table->cell_data[i]->user_data) {
if(table->cell_data[i] && table->cell_data[i]->user_data) {
lv_free(table->cell_data[i]->user_data);
table->cell_data[i]->user_data = NULL;
}

View File

@ -17,6 +17,13 @@ void tearDown(void)
lv_obj_clean(lv_screen_active());
}
void test_table_should_set_row_count_to_zero(void)
{
lv_table_set_row_count(table, 0);
TEST_ASSERT_EQUAL_UINT32(0, lv_table_get_row_count(table));
}
void test_table_should_return_assigned_cell_value(void)
{
uint16_t row = 0;