Check that the data buffer is non-null before getting its file contents.

llvm-svn: 162400
This commit is contained in:
Jim Ingham 2012-08-22 21:21:16 +00:00
parent 7d63968d30
commit 1e4f425d2f
1 changed files with 5 additions and 1 deletions

View File

@ -2422,7 +2422,11 @@ TargetProperties::GetExpressionPrefixContentsAsCString ()
const uint32_t idx = ePropertyExprPrefix;
OptionValueFileSpec *file = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec (NULL, false, idx);
if (file)
return (const char *)file->GetFileContents()->GetBytes();
{
DataBufferSP data_sp(file->GetFileContents());
if (data_sp)
return (const char *) data_sp->GetBytes();
}
return NULL;
}