title: basic_string::_S_construct null not valid - can't figure out why?
body: <p>I am converting some code so to stop using char*, and use std::string instead for avoiding memory leaks and/or buffer overloads. </p>
  
  <p>But I have come to a function where I get the above error. I haven't really changed much atm:</p>
  
  <pre><code>GuiText::GuiText(std::string t, int s, XeColor c) {
  origText = NULL;
  text = NULL;
  size = s;
  color = c;
  alpha = c.a;
  style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE;
  maxWidth = 0;
  wrap = false;
  textDynNum = 0;
  textScroll = SCROLL_NONE;
  textScrollPos = 0;
  textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
  textScrollDelay = TEXT_SCROLL_DELAY;
  
  alignmentHor = ALIGN_CENTRE;
  alignmentVert = ALIGN_MIDDLE;
  
  if (!t.empty()) {
      origText = strdup(t.c_str());
      text = charToWideChar(gettext(t.c_str()));
  }
  
  for (int i = 0; i &lt; 20; i++)
      textDyn[i] = NULL;
  }
  </code></pre>
  
  <p>All of the code is here <a href="https://github.com/siz-/xmplayer/blob/temp/source/libwiigui/gui_text.cpp#L32" rel="nofollow">https://github.com/siz-/xmplayer/blob/temp/source/libwiigui/gui_text.cpp#L32</a></p>
  
  <p>All was daisy becasue I have numerous instances of GuiText, but when I comment the function using const char* on line 59 and in gui.h to actually make my code use the correct function, i get the above error.. I can't see why.. </p>
  
  <p><a href="https://github.com/siz-/xmplayer/blob/temp/source/libwiigui/gui_text.cpp#L59" rel="nofollow">https://github.com/siz-/xmplayer/blob/temp/source/libwiigui/gui_text.cpp#L59</a>
  <a href="https://github.com/siz-/xmplayer/blob/temp/source/libwiigui/gui.h#L685" rel="nofollow">https://github.com/siz-/xmplayer/blob/temp/source/libwiigui/gui.h#L685</a></p>
  
  <p>Example of how it's used: 
  <a href="https://github.com/siz-/xmplayer/blob/temp/source/menu.cpp#L427" rel="nofollow">https://github.com/siz-/xmplayer/blob/temp/source/menu.cpp#L427</a></p>
  
  <p>Any ideas? I have already converted all of gui_text.cpp, but same error, so better to try to pinpoint the problem and get going from there.</p>
  
  <p>Hope you can help a newb ;-)</p>