mirror of
https://github.com/swaywm/sway.git
synced 2024-11-17 13:42:36 +00:00
Merge pull request #1251 from Hummer12007/icons
Handle getline failure in icon theme parsing
This commit is contained in:
commit
7ca0912527
|
@ -49,8 +49,7 @@ static list_t *find_inherits(const char *theme_dir) {
|
||||||
|
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
while (!feof(index)) {
|
while (!feof(index) && getline(&buf, &n, index) != -1) {
|
||||||
getline(&buf, &n, index);
|
|
||||||
if (n <= sizeof(inherits) + 1) {
|
if (n <= sizeof(inherits) + 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -247,9 +246,8 @@ static list_t* find_theme_subdirs(const char *theme_dir) {
|
||||||
|
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
while (!feof(index)) {
|
|
||||||
const char directories[] = "Directories";
|
const char directories[] = "Directories";
|
||||||
getline(&buf, &n, index);
|
while (!feof(index) && getline(&buf, &n, index) != -1) {
|
||||||
if (n <= sizeof(directories) + 1) {
|
if (n <= sizeof(directories) + 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -261,10 +259,8 @@ static list_t* find_theme_subdirs(const char *theme_dir) {
|
||||||
}
|
}
|
||||||
// Now, find the size of each dir
|
// Now, find the size of each dir
|
||||||
struct subdir *current_subdir = NULL;
|
struct subdir *current_subdir = NULL;
|
||||||
while (!feof(index)) {
|
|
||||||
const char size[] = "Size";
|
const char size[] = "Size";
|
||||||
getline(&buf, &n, index);
|
while (!feof(index) && getline(&buf, &n, index) != -1) {
|
||||||
|
|
||||||
if (buf[0] == '[') {
|
if (buf[0] == '[') {
|
||||||
int len = strlen(buf);
|
int len = strlen(buf);
|
||||||
if (buf[len-1] == '\n') {
|
if (buf[len-1] == '\n') {
|
||||||
|
|
Loading…
Reference in a new issue