diff --git a/src/apps/terminal/AppearPrefView.cpp b/src/apps/terminal/AppearPrefView.cpp index 17345a57a2..64eb813c5a 100644 --- a/src/apps/terminal/AppearPrefView.cpp +++ b/src/apps/terminal/AppearPrefView.cpp @@ -492,7 +492,9 @@ AppearancePrefView::_MakeMenu(uint32 msg, const char** items, i++; } - menu->FindItem(defaultItemName)->SetMarked(true); + BMenuItem* defaultItem = menu->FindItem(defaultItemName); + if (defaultItem) + defaultItem->SetMarked(true); return menu; } diff --git a/src/apps/terminal/BasicTerminalBuffer.cpp b/src/apps/terminal/BasicTerminalBuffer.cpp index 0174b000d5..5658216bc6 100644 --- a/src/apps/terminal/BasicTerminalBuffer.cpp +++ b/src/apps/terminal/BasicTerminalBuffer.cpp @@ -98,9 +98,20 @@ BasicTerminalBuffer::_CursorChanged() BasicTerminalBuffer::BasicTerminalBuffer() : + fWidth(0), + fHeight(0), + fScrollTop(0), + fScrollBottom(0), fScreen(NULL), + fScreenOffset(0), fHistory(NULL), - fTabStops(NULL) + fSoftWrappedCursor(false), + fOverwriteMode(false), + fAlternateScreenActive(false), + fOriginMode(false), + fSavedOriginMode(false), + fTabStops(NULL), + fEncoding(M_UTF8) { } diff --git a/src/apps/terminal/BasicTerminalBuffer.h b/src/apps/terminal/BasicTerminalBuffer.h index 951ce15dc5..6caef3c3be 100644 --- a/src/apps/terminal/BasicTerminalBuffer.h +++ b/src/apps/terminal/BasicTerminalBuffer.h @@ -45,6 +45,11 @@ struct TerminalBufferDirtyInfo { invalidateAll = false; messageSent = false; } + + TerminalBufferDirtyInfo() + { + Reset(); + } }; diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp index 4ee9153096..856e12dcd0 100644 --- a/src/apps/terminal/TermParse.cpp +++ b/src/apps/terminal/TermParse.cpp @@ -83,6 +83,8 @@ TermParse::TermParse(int fd) fBuffer(NULL), fQuitting(true) { + memset(fReadBuffer, 0, READ_BUF_SIZE); + memset(fParserBuffer, 0, ESC_PARSER_BUFFER_SIZE); } diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index e5aa246c59..1012160007 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -1858,8 +1858,8 @@ TermView::MessageReceived(BMessage *msg) int32 i; int32 encodingID; BMessage specifier; - msg->GetCurrentSpecifier(&i, &specifier); - if (!strcmp("encoding", specifier.FindString("property", i))){ + if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK + && !strcmp("encoding", specifier.FindString("property", i))) { msg->FindInt32 ("data", &encodingID); SetEncoding(encodingID); msg->SendReply(B_REPLY); @@ -1873,8 +1873,8 @@ TermView::MessageReceived(BMessage *msg) { int32 i; BMessage specifier; - msg->GetCurrentSpecifier(&i, &specifier); - if (!strcmp("encoding", specifier.FindString("property", i))){ + if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK + && !strcmp("encoding", specifier.FindString("property", i))) { BMessage reply(B_REPLY); reply.AddInt32("result", Encoding()); msg->SendReply(&reply);