Tracker: Unchecked dynamic_cast, CID 600348

This commit is contained in:
John Scipione 2014-07-24 22:01:59 -04:00
parent d2af6ff104
commit 9fc1e7ffae

View File

@ -342,7 +342,7 @@ FindWindow::QueryName() const
static const char* static const char*
MakeValidFilename(BString &string) MakeValidFilename(BString& string)
{ {
// make a file name that is legal under bfs and hfs - possibly could // make a file name that is legal under bfs and hfs - possibly could
// add code here to accomodate FAT32 etc. too // add code here to accomodate FAT32 etc. too
@ -368,8 +368,6 @@ void
FindWindow::GetPredicateString(BString& predicate, bool& dynamicDate) FindWindow::GetPredicateString(BString& predicate, bool& dynamicDate)
{ {
BQuery query; BQuery query;
BTextControl* textControl
= dynamic_cast<BTextControl*>(FindView("TextControl"));
switch (fBackground->Mode()) { switch (fBackground->Mode()) {
case kByNameItem: case kByNameItem:
fBackground->GetByNamePredicate(&query); fBackground->GetByNamePredicate(&query);
@ -377,8 +375,13 @@ FindWindow::GetPredicateString(BString& predicate, bool& dynamicDate)
break; break;
case kByFormulaItem: case kByFormulaItem:
predicate.SetTo(textControl->TextView()->Text(), 1023); {
BTextControl* textControl
= dynamic_cast<BTextControl*>(FindView("TextControl"));
if (textControl != NULL)
predicate.SetTo(textControl->TextView()->Text(), 1023);
break; break;
}
case kByAttributeItem: case kByAttributeItem:
fBackground->GetByAttrPredicate(&query, dynamicDate); fBackground->GetByAttrPredicate(&query, dynamicDate);