Skip to content

Commit 90bcbdf

Browse files
author
玉渊
committed
增加堆栈信息的判空,防止空对象
1 parent 29aa040 commit 90bcbdf

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

IOS/SDK/LuaViewSDK/Classes/lvsdk/LVTimer.m

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,15 @@ static int setCallback (lua_State *L) {
113113

114114
static int start (lua_State *L) {
115115
LVUserDataInfo * user = (LVUserDataInfo *)lua_touserdata(L, 1);
116-
LVTimer* timer = (__bridge LVTimer *)(user->object);
117-
if( lua_gettop(L)>=2 ) {
118-
timer.interval = lua_tonumber(L, 2);
119-
}
120-
if( lua_gettop(L)>=3 ) {
121-
timer.repeat = lua_toboolean(L, 3);
122-
}
123-
if( user ){
116+
117+
if ( user ) {
118+
LVTimer* timer = (__bridge LVTimer *)(user->object);
119+
if( lua_gettop(L)>=2 ) {
120+
timer.interval = lua_tonumber(L, 2);
121+
}
122+
if( lua_gettop(L)>=3 ) {
123+
timer.repeat = lua_toboolean(L, 3);
124+
}
124125
if( timer ){
125126
[timer startTimer];
126127
lua_pushvalue(L,1);

0 commit comments

Comments
 (0)