Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2017-03-16 01:46:15 +0300
committerOliver Schneider <oliver@assarbad.net>2017-03-16 01:46:15 +0300
commitecfa9ae6ef07f42ad6c732e4b141ddcc52f58c4c (patch)
treecba14df0f9895046ba46c802036c5e6cc47ba565
parente6b972d4069fe63d66e59a94a789df1924e9215f (diff)
Adding error checks in two places
--HG-- branch : WDS-build
-rw-r--r--.hgignore1
-rw-r--r--src/host/os_match.c13
-rw-r--r--src/host/os_uuid.c4
3 files changed, 14 insertions, 4 deletions
diff --git a/.hgignore b/.hgignore
index fa9c505..ef2ea98 100644
--- a/.hgignore
+++ b/.hgignore
@@ -41,3 +41,4 @@ intermediate/**
premake4.exe
src/host/hgtip.h
*.asc
+.vs/**
diff --git a/src/host/os_match.c b/src/host/os_match.c
index 460bf5f..3e20282 100644
--- a/src/host/os_match.c
+++ b/src/host/os_match.c
@@ -36,9 +36,16 @@ int os_matchstart(lua_State* L)
{
const char* mask = luaL_checkstring(L, 1);
MatchInfo* m = (MatchInfo*)malloc(sizeof(MatchInfo));
- m->handle = FindFirstFile(mask, &m->entry); /* error handling happens in os_matchnext() below */
- m->is_first = 1;
- lua_pushlightuserdata(L, m);
+ if (m)
+ {
+ m->handle = FindFirstFile(mask, &m->entry); /* error handling happens in os_matchnext() below */
+ m->is_first = 1;
+ lua_pushlightuserdata(L, m);
+ }
+ else
+ {
+ lua_pushnil(L);
+ }
return 1;
}
diff --git a/src/host/os_uuid.c b/src/host/os_uuid.c
index 28be4e8..e3bee6b 100644
--- a/src/host/os_uuid.c
+++ b/src/host/os_uuid.c
@@ -15,7 +15,9 @@ int os_uuid(lua_State* L)
char uuid[38];
#if PLATFORM_WINDOWS
- CoCreateGuid((GUID*)bytes);
+ HRESULT hr = CoCreateGuid((GUID*)bytes);
+ if (FAILED(hr))
+ return 0;
#else
int result;