Skip to content

Commit

Permalink
Handle bad field type gracefuly
Browse files Browse the repository at this point in the history
... and fix gcc warning
  • Loading branch information
pavouk committed Sep 19, 2012
1 parent d8dfd8c commit 323db82
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lgi/marshal.c
Expand Up @@ -1243,9 +1243,10 @@ lgi_marshal_field (lua_State *L, gpointer object, gboolean getmode,
/* Prepare proper error message. */
lua_concat (L, lgi_type_get_name (L,
g_base_info_get_container (*fi)));
luaL_error (L, "%s: field `%s' is not %s", lua_tostring (L, -1),
g_base_info_get_name (*fi),
getmode ? "readable" : "writable");
return luaL_error (L, "%s: field `%s' is not %s",
lua_tostring (L, -1),
g_base_info_get_name (*fi),
getmode ? "readable" : "writable");
}

/* Map GIArgument to proper memory location, get typeinfo of the
Expand Down Expand Up @@ -1333,6 +1334,9 @@ lgi_marshal_field (lua_State *L, gpointer object, gboolean getmode,
return 0;
}
}

default:
return luaL_error (L, "field has bad kind %d", kind);
}
}

Expand Down

0 comments on commit 323db82

Please sign in to comment.