Jump to content
  • Advertisement
Sign in to follow this  
Tradone

[Answered]Runtime Error. What is instance of 'std::logic_error'

This topic is 4463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is anybody familiar with this error?
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct NULL not valid
Abort (core dumped)


I yahooed and googled them but apparently, no information was available. [Edited by - Tradone on April 3, 2006 10:07:20 PM]

Share this post


Link to post
Share on other sites
Advertisement
That is one of the standard exception classes. You are constructing an std::string with a null character pointer. Can you post your code?


jfl.

Share this post


Link to post
Share on other sites
it's about 25 files all together. urm... do I have to still post it?

can you give me an example of what might have been done?
and where can I get information on standard runtime errors like those?
i searched them in the engines and i got no matches. :(

Share this post


Link to post
Share on other sites
okay, i fixed it

Error:

Function Parameter::GetData(){
long count = 0;
inputData = "";
char ch;

while (count < envVars.contentLength){
cin.get(ch);
inputData += ch;
count++;
}

if (inputData == "" )
return Failure;

return Success;
}




No Error:


Function Parameter::GetData(){
long count = 0;
inputData = "";
char ch;

while (count < envVars.contentLength){
cin.get(ch);
inputData += ch;
count++;
}

return Success;
}




Difference:

if (inputData == "" )
return Failure;



Thanks!
and if you can just leave me a reference site for the runtime errors.

Share this post


Link to post
Share on other sites
If you still want to check if it's a failure, simply check the string's length (>0).
Now, is the compiler assuming that "" is NULL? I thought it would be considered as {'\0'} or something like that...

Share this post


Link to post
Share on other sites
Quote:
Original post by deadimp
If you still want to check if it's a failure, simply check the string's length (>0).


Well, we don't even know what inputData, Success, Failure or Function are, so it's hard to pinpoint what he may be doing wrong.

Quote:
Now, is the compiler assuming that "" is NULL?


No.

Quote:
I thought it would be considered as {'\0'} or something like that...


Yes.

Share this post


Link to post
Share on other sites
Sorry, but I'm still not getting it. How does that conditional have anything to do with NULL character array initialization?
(My brain left after school)

Share this post


Link to post
Share on other sites

Function Parameter::GetData(){
long count = 0;
inputData = "";
char ch;

while (count < envVars.contentLength){
cin.get(ch);
inputData += ch;
count++;
}

if (inputData == "" )
return Failure;

return Success;
}

Function Parameter::SetParameter(){
string s;

if (!GetData())
return Failure;

s = inputData + "&";



[lol]
Seems like I left you guys all puzzled for not showing the whole thing.
okay. here it is.

So the I found out that Parameter::SetParameter() was the method with fault.

Thus, by adding

if (inputData == "" )
return Failure;


I don't have to execute this code.

s = inputData + "&";


and inputData is a private member variable of the class Parameter.

So since inputData = ""
I am trying to do
s = "" + "&"

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!