region: Fix crash in keyboard layout population
The previous code would crash if 'variants' was null and 'layouts' had more than one element in it.
This commit is contained in:
parent
1b81221092
commit
412472c16d
1 changed files with 2 additions and 1 deletions
|
@ -1330,7 +1330,8 @@ add_input_sources_from_localed (CcRegionPanel *self)
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
for (i = 0; i < n && layouts[i][0]; i++) {
|
for (i = 0; i < n && layouts[i][0]; i++) {
|
||||||
g_autoptr(CcInputSourceXkb) source = cc_input_source_xkb_new (self->xkb_info, layouts[i], variants[i]);
|
const char *variant = variants ? variants[i] : NULL;
|
||||||
|
g_autoptr(CcInputSourceXkb) source = cc_input_source_xkb_new (self->xkb_info, layouts[i], variant);
|
||||||
add_input_row (self, CC_INPUT_SOURCE (source));
|
add_input_row (self, CC_INPUT_SOURCE (source));
|
||||||
}
|
}
|
||||||
gtk_widget_set_visible (GTK_WIDGET (self->no_inputs_row), n == 0);
|
gtk_widget_set_visible (GTK_WIDGET (self->no_inputs_row), n == 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue