1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

[leds] Check for NULL

This commit is contained in:
Witold Filipczyk 2022-01-04 16:30:23 +01:00
parent cae74f8d8e
commit 2da72b11c0

View File

@ -225,7 +225,9 @@ draw_temperature(struct session *ses, int xpos, int ypos, struct color_pair *col
if (!f) return 0;
fscanf(f, "%d", &temp);
fclose(f);
init_string(&text);
if (!init_string(&text)) {
return 0;
}
add_format_to_string(&text, "[%d°C]", (int)(temp * 0.001 + 0.5));
#ifdef CONFIG_UTF8
length = utf8_ptr2cells(text.source, NULL);