Skip to content

Commit adf7620

Browse files
Tom94wjakob
authored andcommitted
fix(file_dialog): free of uninitialized enumerator
1 parent 2b5b626 commit adf7620

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/common.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,6 @@ file_dialog(Widget *parent,
363363
else if (result != NFD_OKAY)
364364
throw std::runtime_error("nanogui::file_dialog(): dialog error: " + std::string(NFD_GetError()));
365365

366-
enumerator_set = true;
367-
368366
std::vector<std::string> paths;
369367

370368
switch (type) {
@@ -378,6 +376,7 @@ file_dialog(Widget *parent,
378376
case FileDialogType::OpenMultiple:
379377
if (!NFD_PathSet_GetEnum(out_paths, &enumerator))
380378
throw std::runtime_error("nanogui::file_dialog(): could not obtain enumerator: " + std::string(NFD_GetError()));
379+
enumerator_set = true;
381380
while (NFD_PathSet_EnumNextU8(&enumerator, &out_path) && out_path)
382381
paths.emplace_back(out_path);
383382
break;

0 commit comments

Comments
 (0)