Skip to content

Commit

Permalink
Fix crash for TypeScript enum in substruct
Browse files Browse the repository at this point in the history
See #8299.
  • Loading branch information
fergushenderson committed Oct 15, 2024
1 parent 807adb7 commit 90be086
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/idl_gen_ts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,11 +901,15 @@ class TsGenerator : public BaseGenerator {

std::string bare_file_path;
std::string rel_file_path;
const auto &dep_comps = dependent.defined_namespace->components;
for (size_t i = 0; i < dep_comps.size(); i++) {
rel_file_path += i == 0 ? ".." : (kPathSeparator + std::string(".."));
if (dependent.defined_namespace) {
const auto &dep_comps = dependent.defined_namespace->components;
for (size_t i = 0; i < dep_comps.size(); i++) {
rel_file_path += i == 0 ? ".." : (kPathSeparator + std::string(".."));
}
if (dep_comps.size() == 0) { rel_file_path += "."; }
} else {
rel_file_path += "..";
}
if (dep_comps.size() == 0) { rel_file_path += "."; }

bare_file_path +=
kPathSeparator +
Expand Down

0 comments on commit 90be086

Please sign in to comment.