Skip to content

Commit

Permalink
make sarg explicit in lua songman chartkey functions and return nil i…
Browse files Browse the repository at this point in the history
…nstead of a null object
  • Loading branch information
MinaciousGrace committed May 2, 2017
1 parent a5ec3ed commit 789181f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/SongManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2305,14 +2305,22 @@ class LunaSongManager: public Luna<SongManager>
}
static int GetSongByChartKey(T* p, lua_State *L)
{
Song* pSong = p->GetSongByChartkey(SArg(1));
pSong->PushSelf(L);
RString ck = SArg(1);
Song* pSong = p->GetSongByChartkey(ck);
if (pSong)
pSong->PushSelf(L);
else
lua_pushnil(L);
return 1;
}
static int GetStepsByChartKey(T* p, lua_State *L)
{
Steps* pSteps = p->GetStepsByChartkey(SArg(1));
pSteps->PushSelf(L);
RString ck = SArg(1);
Steps* pSteps = p->GetStepsByChartkey(ck);
if (pSteps)
pSteps->PushSelf(L);
else
lua_pushnil(L);
return 1;
}

Expand Down

0 comments on commit 789181f

Please sign in to comment.