]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/dap: fix completion request for empty strings
authorJorenar <dev@jorenar.com>
Sun, 25 May 2025 15:40:25 +0000 (17:40 +0200)
committerTom Tromey <tromey@adacore.com>
Thu, 29 May 2025 17:04:18 +0000 (11:04 -0600)
commitaed5eee5a355788637fea8004fbb96f4eee35efa
tree089c328f15920cd7e4db6eb1100360ff801cf54f
parentbc5237a2632c5fca868feebc1ac4974be5dda4a3
gdb/dap: fix completion request for empty strings

When DAP completion requests receives empty string to complete,
the script crashes due trying to access element -1 from list
being a result of `text.splitlines()` (which for `text == ""`
evaluates into empty list).

This patch adds simple check if `text` is populated, and when it
is not, skips transformations and assigns correct result directly.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/python/lib/gdb/dap/completions.py