Skip to content

Commit

Permalink
update.c: work around segfault
Browse files Browse the repository at this point in the history
fixes #29
  • Loading branch information
01micko committed Nov 12, 2024
1 parent 4f45803 commit 77f8e3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ environment_get(char *buffer, size_t size, const char *key)
void
environment_set(const char *key, const char *value)
{
if (!key || !*key) {
return;
}
if (!value || !*value) {
return;
}

/* set cursor for labwc - should cover 'replace' or 'append' */
char xcur[4096] = {0};
strcpy(xcur, key);
Expand Down
3 changes: 3 additions & 0 deletions update.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ spawn_sync(char const *command)
static const char
*first_field(const char *s, char delim)
{
if (!s) {
return NULL;
}
char *p = strchr(s, delim);
if (p) {
*p = '\0';
Expand Down

0 comments on commit 77f8e3d

Please sign in to comment.