From 7a574c6cbd281371d0e21d7ec12c972c7f5271ec Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 16 Jun 2011 22:53:55 +0000 Subject: [PATCH] Check that a source file is in fact available before attempting to use it to generate a clipping name. Fixes #7704. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42217 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../user_interface/gui/team_window/SourceView.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp index 9e16aab937..831c0895f9 100644 --- a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp @@ -32,6 +32,7 @@ #include "FileSourceCode.h" #include "LocatableFile.h" #include "MessageCodes.h" +#include "SourceLanguage.h" #include "StackTrace.h" #include "Statement.h" #include "Team.h" @@ -1232,7 +1233,13 @@ SourceView::TextView::MouseMoved(BPoint where, uint32 transit, BMessage message; message.AddData ("text/plain", B_MIME_TYPE, text.String(), text.Length()); - BString clipName = fSourceCode->GetSourceFile()->Name(); + BString clipName; + if (fSourceCode->GetSourceFile() != NULL) + clipName = fSourceCode->GetSourceFile()->Name(); + else if (fSourceCode->GetSourceLanguage() != NULL) + clipName = fSourceCode->GetSourceLanguage()->Name(); + else + clipName = "Text"; clipName << " clipping"; message.AddString ("be:clip_name", clipName.String()); message.AddInt32 ("be:actions", B_COPY_TARGET);