Fixed dereferenced null pointer

This commit is contained in:
Markus Gans 2018-05-27 22:58:22 +02:00
parent 0927e4e1fb
commit 9e46fbb4f9
3 changed files with 18 additions and 15 deletions

View File

@ -443,6 +443,7 @@ class FTerm
static bool init_force_vt100_encoding();
static void init_utf8_without_alt_charset();
static void init_tab_quirks();
static void init_captureFontAndTitle();
static void redefineColorPalette();
static void restoreColorPalette();
static void setInsertCursorStyle();

View File

@ -2394,6 +2394,22 @@ void FTerm::init_tab_quirks()
}
}
//----------------------------------------------------------------------
void FTerm::init_captureFontAndTitle()
{
// Save the used xterm font and window title
xterm->captureFontAndTitle();
const FString* font = xterm->getFont();
const FString* title = xterm->getTitle();
if ( font )
save_xterm_font = new FString(*font);
if ( title )
save_xterm_title = new FString(*title);
}
//----------------------------------------------------------------------
void FTerm::redefineColorPalette()
{
@ -2697,9 +2713,7 @@ void FTerm::init()
}
// Save the used xterm font and window title
xterm->captureFontAndTitle();
save_xterm_font = new FString(*(xterm->getFont()));
save_xterm_title = new FString(*(xterm->getTitle()));
init_captureFontAndTitle();
if ( isKdeTerminal() )
setKDECursor(fc::UnderlineCursor);

View File

@ -210,18 +210,6 @@ void FStringTest::noArgumentTest()
empty.clear();
CPPUNIT_ASSERT ( empty.isNull() );
const std::string* str1 = 0;
FString s1(*str1);
CPPUNIT_ASSERT ( s1.isEmpty() );
CPPUNIT_ASSERT ( s1.isNull() );
CPPUNIT_ASSERT ( ! s1 );
const FString* str2 = 0;
FString s2(*str2);
CPPUNIT_ASSERT ( s2.isEmpty() );
CPPUNIT_ASSERT ( s2.isNull() );
CPPUNIT_ASSERT ( ! s2 );
}
//----------------------------------------------------------------------