Skip to content

Commit f9035a8

Browse files
committed
jsdialog: warn if we didn't process event in Dropdown
Signed-off-by: Szymon Kłos <[email protected]> Change-Id: I771d093a7a5b7027c91a1b23ee985aadff655e9b
1 parent c0fbe4d commit f9035a8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

browser/src/control/jsdialog/Util.Dropdown.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ JSDialog.OpenDropdown = function (
167167
let pos = -1;
168168
if (typeof data === 'number') pos = data;
169169
else pos = data ? parseInt(data.substr(0, data.indexOf(';'))) : -1;
170-
const entry = targetEntries && pos > 0 ? targetEntries[pos] : null;
170+
const entry = targetEntries && pos >= 0 ? targetEntries[pos] : null;
171171
const subMenuId = object.id + '-' + pos;
172172

173173
if (eventType === 'selected' || eventType === 'showsubmenu') {
@@ -209,6 +209,14 @@ JSDialog.OpenDropdown = function (
209209
window.L.Map.THIS.sendUnoCommand(uno);
210210
JSDialog.CloseDropdown(id);
211211
return;
212+
} else {
213+
app.console.error(
214+
'Dropdown: unhandled action: "' +
215+
eventType +
216+
'" for entry: "' +
217+
JSON.stringify(entry) +
218+
'"',
219+
);
212220
}
213221
} else if (eventType === 'hidedropdown') {
214222
closeLastSubMenu();

0 commit comments

Comments
 (0)