summaryrefslogtreecommitdiff
path: root/plugins/Weather/src/weather_http.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Weather/src/weather_http.cpp')
-rw-r--r--plugins/Weather/src/weather_http.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp
index 89cac41c2f..7d63c1ad6c 100644
--- a/plugins/Weather/src/weather_http.cpp
+++ b/plugins/Weather/src/weather_http.cpp
@@ -103,16 +103,20 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, TCHAR **szD
char* beg = strstr(end, "<meta");
if (beg == NULL) break;
else {
- char* method, tmp;
end = strchr(beg, '>');
- tmp = *end; *end = 0;
-
- method = strstr(beg, "http-equiv=\"");
- if (method && _strnicmp(method + 12, "Content-Type", 12) == 0 && strstr(method, "utf-8")) {
- bIsUtf = true;
- break;
+ if (end)
+ {
+ char tmp = *end;
+ *end = 0;
+
+ char *method = strstr(beg, "http-equiv=\"");
+ if (method && _strnicmp(method + 12, "Content-Type", 12) == 0 && strstr(method, "utf-8")) {
+ bIsUtf = true;
+ *end = tmp;
+ break;
+ }
+ else *end = tmp;
}
- else *end = tmp;
}
}
}