aboutsummaryrefslogtreecommitdiff
path: root/src/pkg_exists.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg_exists.c')
-rw-r--r--src/pkg_exists.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pkg_exists.c b/src/pkg_exists.c
index 05aa238..3ff761a 100644
--- a/src/pkg_exists.c
+++ b/src/pkg_exists.c
@@ -1,8 +1,7 @@
/*
pkgit - package it!
-
- Copyright (C) 2026 dacctal
+Copyright (C) 2026 dacctal
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
@@ -27,7 +26,10 @@ bool pkg_exists(str *name) {
lua_pop(L, 1);
return false;
}
- if (!lua_try_table(L, "init.lua", name->data)) {
+ str_slc new_name = {name->data, name->len};
+ char* name_cstr = (char*)new_name.data;
+ name_cstr[new_name.len] = '\0';
+ if (!lua_try_table(L, "init.lua", name_cstr)) {
lua_pop(L, 2);
return false;
}