GP-6248 fix text in title bar of search for encoded strings dialog

if selection does not have addresses, or if address map is empty, don't
show "null - null".
This commit is contained in:
dev747368
2025-12-17 23:11:01 +00:00
parent 2f06823fba
commit 3a54baa89e
2 changed files with 8 additions and 6 deletions

View File

@@ -1103,9 +1103,11 @@ public class EncodedStringsDialog extends DialogComponentProvider {
}
private static String makeTitleString(AddressSetView addrs) {
return "Search For Encoded Strings - %s (%s - %s)".formatted(
formatLength(addrs.getNumAddresses(), "addresses"), addrs.getMinAddress(),
addrs.getMaxAddress());
String addrRangeStr = !addrs.isEmpty()
? "(%s - %s)".formatted(addrs.getMinAddress(), addrs.getMaxAddress())
: "";
return "Search For Encoded Strings - %s %s"
.formatted(formatLength(addrs.getNumAddresses(), "addresses"), addrRangeStr);
}
private static boolean charsetExists(String charsetName) {

View File

@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -113,7 +113,7 @@ public class EncodedStringsPlugin extends ProgramPlugin {
}
private void showSearchForEncodedStrings(NavigatableActionContext lac) {
AddressSetView addrs = lac.hasSelection()
AddressSetView addrs = lac.hasSelection() && !lac.getSelection().isEmpty()
? lac.getSelection()
: lac.getProgram().getMemory().getAllInitializedAddressSet();
EncodedStringsDialog dlg = new EncodedStringsDialog(this, lac.getProgram(), addrs);