Skip to content

[bugfix] Fix crash with invalid argument type passed to os.locate #2449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/host/os_locate.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ int os_locate(lua_State* L)
for (i = 1; i <= nArgs; ++i) {
const char* name = lua_tostring(L, i);

if (name == NULL) {
continue;
}

/* Direct path to an embedded file? */
if (name[0] == '$' && name[1] == '/' && premake_find_embedded_script(name + 2)) {
lua_pushvalue(L, i);
Expand Down
6 changes: 3 additions & 3 deletions website/docs/os/os.locate.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Searches the [Premake path](Locating-Scripts.md) for a file.
Searches the [Premake path](Locating-Scripts.md) for files.

```lua
os.locate("file_name")
os.locate("file_name1", ...)
```

### Parameters ###
Expand All @@ -11,7 +11,7 @@ os.locate("file_name")

### Return Value ###

The full path to the file if found, or nil if the file could not be located.
The full path to the first file found, or nil if the files could not be located.


### Availability ###
Expand Down