Skip to content

Commit c632691

Browse files
authored
DialogEx: Fix NULL ptr crash (#3878)
1 parent 20aff73 commit c632691

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

applications/services/gui/modules/dialog_ex.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void dialog_ex_set_header(
222222
dialog_ex->view,
223223
DialogExModel * model,
224224
{
225-
furi_string_set(model->header.text, text);
225+
furi_string_set(model->header.text, text ? text : "");
226226
model->header.x = x;
227227
model->header.y = y;
228228
model->header.horizontal = horizontal;
@@ -243,7 +243,7 @@ void dialog_ex_set_text(
243243
dialog_ex->view,
244244
DialogExModel * model,
245245
{
246-
furi_string_set(model->text.text, text);
246+
furi_string_set(model->text.text, text ? text : "");
247247
model->text.x = x;
248248
model->text.y = y;
249249
model->text.horizontal = horizontal;
@@ -268,15 +268,18 @@ void dialog_ex_set_icon(DialogEx* dialog_ex, uint8_t x, uint8_t y, const Icon* i
268268
void dialog_ex_set_left_button_text(DialogEx* dialog_ex, const char* text) {
269269
furi_check(dialog_ex);
270270
with_view_model(
271-
dialog_ex->view, DialogExModel * model, { furi_string_set(model->left_text, text); }, true);
271+
dialog_ex->view,
272+
DialogExModel * model,
273+
{ furi_string_set(model->left_text, text ? text : ""); },
274+
true);
272275
}
273276

274277
void dialog_ex_set_center_button_text(DialogEx* dialog_ex, const char* text) {
275278
furi_check(dialog_ex);
276279
with_view_model(
277280
dialog_ex->view,
278281
DialogExModel * model,
279-
{ furi_string_set(model->center_text, text); },
282+
{ furi_string_set(model->center_text, text ? text : ""); },
280283
true);
281284
}
282285

@@ -285,7 +288,7 @@ void dialog_ex_set_right_button_text(DialogEx* dialog_ex, const char* text) {
285288
with_view_model(
286289
dialog_ex->view,
287290
DialogExModel * model,
288-
{ furi_string_set(model->right_text, text); },
291+
{ furi_string_set(model->right_text, text ? text : ""); },
289292
true);
290293
}
291294

0 commit comments

Comments
 (0)