shuveb / sparkler

A virtual machine monitor and a tiny "operating system" to go with it. When you start Sparkler, it creates a virtual machine using Linux's KVM API. It is written in C and emulates a serial console and some other devices that fetch a tweet from an account, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fix for air quality error gives seg fault

birchb1024 opened this issue · comments

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..16d9bd2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.o
+monitor
+sparkler
diff --git a/main.c b/main.c
index 1ef2a06..4da836c 100644
--- a/main.c
+++ b/main.c
@@ -295,6 +295,9 @@ int main(void)
                                     strncpy(country, "US", sizeof(country));
                                 }
                                 aq_report = fetch_air_quality(country, city);
+                                if (aq_report == NULL) {
+                                                                       break;
+                                                               }
                             }
                             char aq_chr = *(aq_report + aq_str_idx);
                             *(((char *)run) + run->io.data_offset) = aq_chr;