Skip to content

Commit

Permalink
don't crash with bad ExternalViewers entri
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Jun 2, 2022
1 parent d0aeef6 commit d65baaf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1148,18 +1148,18 @@ static void AppendExternalViewersToMenu(HMENU menuFile, const WCHAR* filePath) {
if (count >= maxEntries) {
break;
}
if (!ev->commandLine) {
if (str::EmptyOrWhiteSpaceOnly(ev->commandLine)) {
continue;
}
if (ev->filter && !(filePath && PathMatchFilter(filePath, ev->filter))) {
continue;
}

WCHAR* name = ToWstrTemp(ev->name);
if (str::IsEmpty(name)) {
if (str::EmptyOrWhiteSpaceOnly(ev->name)) {
CmdLineArgsIter args(ToWstrTemp(ev->commandLine));
int nArgs = args.nArgs - 2;
if (nArgs == 0) {
if (nArgs <= 0) {
continue;
}
WCHAR* arg0 = args.at(2 + 0);
Expand Down

0 comments on commit d65baaf

Please sign in to comment.