Jump to content

'std::logic_error' PROBLEM IN PUTTY


Recommended Posts

After crash channel in putty i have:

terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid

I know this problem calling when i use null somewhere or something like that but i dont know what to fix it and what i should looking in my source, any ideas, help?

Link to comment
Share on other sites

  • 2 months later...

0x081bcd95 in quest::_regen_in_map (L=0x477dd040)
    at questlua_global.cpp:1128
        iMapIndex = 234
        szFilename = {static npos = 4294967295,
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
    _M_p = 0x477d4e5c "arya_dungeon_monster_cycle"}}
        pkMap = <value optimized out>


and in Source this is 1128 line in questlua_global.cpp

Spoiler

std::string szFilename(lua_tostring(L, 2));


any solution ?

Link to comment
Share on other sites

  • Developer

try to change your func with that
 

	int _regen_in_map (lua_State* L)
	{
		int iMapIndex = static_cast<int> (lua_tonumber (L, 1));
		std::string szFilename (lua_tostring (L, 2));
		if(!lua_isnumber(L,1) || !lua_isstring(L,2))
		{
			sys_err("_regen_in_map : you used the function badly , pass me a number and a string please.");
			return 0;
		}
		int iMapIndex = static_cast<int> (lua_tonumber (L, 1));
		LPSECTREE_MAP pkMap = SECTREE_MANAGER::instance().GetMap (iMapIndex);

		if (pkMap != NULL)
		{
			regen_load_in_file (szFilename.c_str(), iMapIndex, pkMap->m_setting.iBaseX , pkMap->m_setting.iBaseY);
		}

		return 0;
	}

 

That func interrupt your called of "regen_in_map" (in lua quest) if you have not passed the function parameters correctly.

this will prevent the game crashing, but you have to find where the function is being used badly (lua func regen_in_map into a lua quest)

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

6 hours ago, riku11 said:

try to change your func with that
 


	int _regen_in_map (lua_State* L)
	{
		int iMapIndex = static_cast<int> (lua_tonumber (L, 1));
		std::string szFilename (lua_tostring (L, 2));
		if(!lua_isnumber(L,1) || !lua_isstring(L,2))
		{
			sys_err("_regen_in_map : you used the function badly , pass me a number and a string please.");
			return 0;
		}
		int iMapIndex = static_cast<int> (lua_tonumber (L, 1));
		LPSECTREE_MAP pkMap = SECTREE_MANAGER::instance().GetMap (iMapIndex);

		if (pkMap != NULL)
		{
			regen_load_in_file (szFilename.c_str(), iMapIndex, pkMap->m_setting.iBaseX , pkMap->m_setting.iBaseY);
		}

		return 0;
	}

 

That func interrupt your called of "regen_in_map" (in lua quest) if you have not passed the function parameters correctly.

this will prevent the game crashing, but you have to find where the function is being used badly (lua func regen_in_map into a lua quest)

thanks for reply and yes im using that regen_in_map in a lua quest so i need to execute it so any possibility that it can be solved instead of bypassing? 

Link to comment
Share on other sites

  • Developer
12 hours ago, riku11 said:

That func interrupt your called of "regen_in_map" (in lua quest) if you have not passed the function parameters correctly.

if after that func your game crash , you are not passing the correct parameters.

regen_in_map( NUMBER , STRING)

  • Love 1

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

well this is my function 
 

Spoiler

    {
        int iMapIndex = static_cast<int>(lua_tonumber(L, 1));
        std::string szFilename(lua_tostring(L, 2));

        LPSECTREE_MAP pkMap = SECTREE_MANAGER::instance().GetMap(iMapIndex);

        if (pkMap != NULL)
        {
            regen_load_in_file( szFilename.c_str(), iMapIndex, pkMap->m_setting.iBaseX ,pkMap->m_setting.iBaseY );
        }

        return 0;
    }

and the lua quest that calling that regen function is 

Spoiler

regen_in_map(data["map_index"], data["regens"][game.get_event_flag("icedungeon_monster_cycle")]);

function.lua
          

Spoiler

 ["regens"] = {
                [1] = "data/dungeon/icedungeon/regen_1.txt",
                [2] = "data/dungeon/icedungeon/regen_2.txt",
                [3] = "data/dungeon/icedungeon/regen_3.txt",
                [4] = "data/dungeon/icedungeon/regen_4.txt",
                [5] = "data/dungeon/icedungeon/regen_5.txt"
            },

and yes after that function only game crashes if i disable that regen_in_map then no crash.. 

Check the statement yes im passing the right parameters

Link to comment
Share on other sites

  • Developer
35 minutes ago, Human said:

well this is my function 
 

  Hide contents

    {
        int iMapIndex = static_cast<int>(lua_tonumber(L, 1));
        std::string szFilename(lua_tostring(L, 2));

        LPSECTREE_MAP pkMap = SECTREE_MANAGER::instance().GetMap(iMapIndex);

        if (pkMap != NULL)
        {
            regen_load_in_file( szFilename.c_str(), iMapIndex, pkMap->m_setting.iBaseX ,pkMap->m_setting.iBaseY );
        }

        return 0;
    }

and the lua quest that calling that regen function is 

  Hide contents

regen_in_map(data["map_index"], data["regens"][game.get_event_flag("icedungeon_monster_cycle")]);

function.lua
          

  Hide contents

 ["regens"] = {
                [1] = "data/dungeon/icedungeon/regen_1.txt",
                [2] = "data/dungeon/icedungeon/regen_2.txt",
                [3] = "data/dungeon/icedungeon/regen_3.txt",
                [4] = "data/dungeon/icedungeon/regen_4.txt",
                [5] = "data/dungeon/icedungeon/regen_5.txt"
            },

and yes after that function only game crashes if i disable that regen_in_map then no crash.. 

Check the statement yes im passing the right parameters

can you starts with replacing the c ++ function with mine, which is anti crash

 

than can you replace your declaration of data["regens"] with this : 


data["regens"] = {}
table.insert(data["regens"],"data/dungeon/icedungeon/regen_1.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_2.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_3.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_4.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_5.txt")



 

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

On 10/4/2017 at 7:24 PM, riku11 said:

can you starts with replacing the c ++ function with mine, which is anti crash

 

than can you replace your declaration of data["regens"] with this : 



data["regens"] = {}
table.insert(data["regens"],"data/dungeon/icedungeon/regen_1.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_2.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_3.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_4.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_5.txt")



 

is that adding in table of db ? 

Link to comment
Share on other sites

  • Developer
1 hour ago, Human said:

is that adding in table of db ? 

no, it's just a different method of doing what you did with your statement with[1],[2],[3].....

 

 

replace this : 

 

["regens"] = {
                [1] = "data/dungeon/icedungeon/regen_1.txt",
                [2] = "data/dungeon/icedungeon/regen_2.txt",
                [3] = "data/dungeon/icedungeon/regen_3.txt",
                [4] = "data/dungeon/icedungeon/regen_4.txt",
                [5] = "data/dungeon/icedungeon/regen_5.txt"
            },

 

with this :

data["regens"] = {}
table.insert(data["regens"],"data/dungeon/icedungeon/regen_1.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_2.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_3.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_4.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_5.txt")

 

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

42 minutes ago, riku11 said:

no, it's just a different method of doing what you did with your statement with[1],[2],[3].....

 

 

replace this : 

 


["regens"] = {
                [1] = "data/dungeon/icedungeon/regen_1.txt",
                [2] = "data/dungeon/icedungeon/regen_2.txt",
                [3] = "data/dungeon/icedungeon/regen_3.txt",
                [4] = "data/dungeon/icedungeon/regen_4.txt",
                [5] = "data/dungeon/icedungeon/regen_5.txt"
            },

 

with this :

42 minutes ago, riku11 said:

data["regens"] = {} or 
 



data["regens"] = {


table.insert(data["regens"],"data/dungeon/icedungeon/regen_1.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_2.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_3.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_4.txt")
table.insert(data["regens"],"data/dungeon/icedungeon/regen_5.txt")

},

?

 

even if i put that too its not working and u dont need to add data coz my function itself has Icedungeon.data  = {

Link to comment
Share on other sites

  • Developer

Can you post quest?

or at least sends the part that interests us in full about the regen function, and whole declarations of its variables used (icedungeon.data)

If you haven't understood it, the regen_in_map function doesn't work because it's badly passing the parameters, even if it may seem that it's not so, but the error that gave you the. core says that the string that passes is wrong / not at all.

 

I want to help you but I must also have the way...

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.