PoseView: Fix assertion in InitDirentIterator

The dynamic_cast was called twice, and the assert was
done on the first attempt. Now it just cast once, assert on this
and pass it further as before.

CID 3122.
This commit is contained in:
Philippe Saint-Pierre
2012-01-04 18:11:12 -05:00
parent fcfd687380
commit d390c06551
+4 -3
View File
@@ -1063,10 +1063,11 @@ BPoseView::InitDirentIterator(const entry_ref *ref)
ASSERT(!sourceModel.IsQuery());
ASSERT(sourceModel.Node());
ASSERT(dynamic_cast<BDirectory *>(sourceModel.Node()));
EntryListBase *result = new CachedDirectoryEntryList(
*dynamic_cast<BDirectory *>(sourceModel.Node()));
BDirectory *directory = dynamic_cast<BDirectory *>(sourceModel.Node());
ASSERT(directory);
EntryListBase *result = new CachedDirectoryEntryList(*directory);
if (result->Rewind() != B_OK) {
delete result;