Skip to content

Commit 72d4771

Browse files
authored
markup_accel_tooltip: Handle null-terminated accels (#903)
1 parent 909acdf commit 72d4771

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Widgets/Utils.vala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ public const string TOOLTIP_SECONDARY_TEXT_MARKUP = """<span weight="600" size="
130130
* Description<<BR>>
131131
* Shortcut 1, Shortcut 2
132132
*
133-
* @param accels a string array of accelerator labels like {"<Control>a", "<Super>Right"}
133+
* @param accels a string array of accelerator labels like {"<Control>a", "<Super>Right"}<<BR>
134+
* The array may be null-terminated.
134135
*
135136
* @param description a standard tooltip text string
136137
*
@@ -149,6 +150,10 @@ public static string markup_accel_tooltip (string[]? accels, string? description
149150
Granite.init ();
150151

151152
for (int i = 0; i < accels.length; i++) {
153+
if (accels[i] == null) {
154+
break;
155+
}
156+
152157
if (accels[i] == "") {
153158
continue;
154159
}

0 commit comments

Comments
 (0)