Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check argument count for existence of optional table parameter #7

Merged

Conversation

dri-richard
Copy link
Contributor

Fixes #6

Copy link
Contributor

@britzl britzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps use lua_isnoneornil(L,1) instead?

@@ -63,7 +64,7 @@ static int Firebase_Init(lua_State* L) {
JNIEnv* env = 0;
dmGraphics::GetNativeAndroidJavaVM()->AttachCurrentThread(&env, NULL);

if (lua_isnil(L, 1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could swap this for lua_isnoneornil(L, 1)

"Returns 1 if the given acceptable index is not valid (that is, it refers to an element outside the current stack) or if the value at this index is nil, and 0 otherwise."

@britzl britzl merged commit 1d9ca2a into defold:master Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on init() with no parameter passed
2 participants