From 82d4ca00958d6d097aee830ac300ecfd9014d2b3 Mon Sep 17 00:00:00 2001
From: Edwin Mons <edwin.mons@isode.com>
Date: Wed, 21 Sep 2016 21:42:38 +0200
Subject: Fix crash in Sluift CommandConvertor

If a command table contained actions or notes, an extraneous lua_pushnil
happened, leading to a crash.

Test-Information:

Rendering a command using to_xml with actions or notes now works as
expected on OS X 10.11

Change-Id: Ic99b2546ac261edf6b52b92e63701f397fc6201a

diff --git a/Sluift/ElementConvertors/CommandConvertor.cpp b/Sluift/ElementConvertors/CommandConvertor.cpp
index 5bc3801..1e2f8e3 100644
--- a/Sluift/ElementConvertors/CommandConvertor.cpp
+++ b/Sluift/ElementConvertors/CommandConvertor.cpp
@@ -91,7 +91,6 @@ std::shared_ptr<Command> CommandConvertor::doConvertFromLua(lua_State* L) {
     lua_getfield(L, -1, "available_actions");
     if (!lua_isnil(L, -1)) {
         Lua::checkType(L, -1, LUA_TTABLE);
-        lua_pushnil(L);
         for (lua_pushnil(L); lua_next(L, -2) != 0; ) {
             result->addAvailableAction(convertActionFromString(Lua::checkString(L, -1)));
             lua_pop(L, 1);
@@ -102,7 +101,6 @@ std::shared_ptr<Command> CommandConvertor::doConvertFromLua(lua_State* L) {
     lua_getfield(L, -1, "notes");
     if (!lua_isnil(L, -1)) {
         Lua::checkType(L, -1, LUA_TTABLE);
-        lua_pushnil(L);
         for (lua_pushnil(L); lua_next(L, -2) != 0; ) {
             Lua::checkType(L, -1, LUA_TTABLE);
             std::string note;
-- 
cgit v0.10.2-6-g49f6