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
This commit is contained in:
Rene Gollent
2011-06-16 22:53:55 +00:00
parent 21e484aea9
commit 7a574c6cbd
@@ -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);