Skip to content

Commit 53bd47e

Browse files
authored
ui : fix llama-ui-embed crash when no asset dir is given (#24597)
1 parent 4988f6e commit 53bd47e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tools/ui/embed.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// llama-ui-embed: generate ui.cpp / ui.h that embed UI assets as C arrays.
22
//
33
// Usage:
4-
// llama-ui-embed <out_cpp> <out_h> <asset_dir>
4+
// llama-ui-embed <out_cpp> <out_h> [<asset_dir>]
55
//
66
// Recursively embeds every regular file under <asset_dir>.
77
// Asset names are relative paths from <asset_dir> (e.g. "_app/immutable/bundle.HASH.js").
@@ -147,9 +147,9 @@ int main(int argc, char ** argv) {
147147

148148
const std::string out_cpp = argv[1];
149149
const std::string out_h = argv[2];
150-
const std::string asset_dir = argv[3];
150+
const std::string asset_dir = (argc >= 4) ? argv[3] : std::string();
151151

152-
const bool use_gzip = std::filesystem::exists(asset_dir + "/_gzip");
152+
const bool use_gzip = !asset_dir.empty() && std::filesystem::exists(asset_dir + "/_gzip");
153153
const std::string in_dir = use_gzip ? (asset_dir + "/_gzip") : asset_dir;
154154

155155
std::vector<asset_entry> assets;

0 commit comments

Comments
 (0)