PVS V595: Pointer was utilized before it was verified against nullptr.

Change-Id: Iba8b7e6160dc237f45080fa7c101fa72e4d8c753
Reviewed-on: https://review.haiku-os.org/c/1643
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Murai Takashi
2019-07-27 15:22:15 +00:00
committed by waddlesplash
parent 3ddf0bbc29
commit 122d4ef7e9
7 changed files with 109 additions and 95 deletions
@@ -196,21 +196,25 @@ void DormantNodeView::MouseMoved(
int32 index;
if (!message && ((index = IndexOf(point)) >= 0)) {
DormantNodeListItem *item = dynamic_cast<DormantNodeListItem *>(ItemAt(index));
DormantNodeListItem *last = dynamic_cast<DormantNodeListItem *>(m_lastItemUnder);
BRect r = item->getRealFrame(be_plain_font);
if (item && r.Contains(point)) {
if (item != last) {
if (last)
last->MouseOver(this, point, B_EXITED_VIEW);
item->MouseOver(this, point, B_ENTERED_VIEW);
m_lastItemUnder = item;
}
else {
item->MouseOver(this, point, B_INSIDE_VIEW);
DormantNodeListItem *item =
dynamic_cast<DormantNodeListItem *>(ItemAt(index));
DormantNodeListItem *last =
dynamic_cast<DormantNodeListItem *>(m_lastItemUnder);
if (item != NULL) {
BRect r = item->getRealFrame(be_plain_font);
if (r.Contains(point)) {
if (item != last) {
if (last != NULL)
last->MouseOver(this, point, B_EXITED_VIEW);
item->MouseOver(this, point, B_ENTERED_VIEW);
m_lastItemUnder = item;
}
else {
item->MouseOver(this, point, B_INSIDE_VIEW);
}
}
}
else if (last) {
else if (last != NULL) {
last->MouseOver(this, point, B_EXITED_VIEW);
}
}
+5 -1
View File
@@ -76,13 +76,17 @@ SavePanel::SavePanel(const char* name,
// find a couple of important views and mess with their layout
BView* background = Window()->ChildAt(0);
if (background == NULL) {
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
return;
}
BButton* cancel = dynamic_cast<BButton*>(
background->FindView("cancel button"));
BView* textview = background->FindView("text view");
BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(
background->FindView("HScrollBar"));
if (!background || !cancel || !textview || !hscrollbar) {
if (!cancel || !textview || !hscrollbar) {
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
return;
}
+4 -3
View File
@@ -14,10 +14,11 @@ KUndoItem::KUndoItem(const char* redo_text, int32 length, int32 offset,
if (redo_text != NULL) {
RedoText = (char*)malloc(length);
memcpy(RedoText, redo_text, length);
if (RedoText != NULL)
if (RedoText != NULL) {
memcpy(RedoText, redo_text, length);
fStatus = B_OK;
else
} else
fStatus = B_ERROR;
}
}
+1 -1
View File
@@ -329,7 +329,7 @@ ScopeView::MouseDown(BPoint position)
void
ScopeView::InitBitmap()
{
if (fBitmapView) {
if (fBitmap != NULL && fBitmapView != NULL) {
fBitmap->RemoveChild(fBitmapView);
delete fBitmapView;
}
+7 -6
View File
@@ -73,14 +73,15 @@ int media_play(const char* uri)
for (int i = 0; i < playFile->CountTracks(); i++) {
BMediaTrack* track = playFile->TrackAt(i);
playFormat.type = B_MEDIA_RAW_AUDIO;
if ((track->DecodedFormat(&playFormat) == B_OK)
if (track != NULL) {
playFormat.type = B_MEDIA_RAW_AUDIO;
if ((track->DecodedFormat(&playFormat) == B_OK)
&& (playFormat.type == B_MEDIA_RAW_AUDIO)) {
playTrack = track;
break;
}
if (track)
playTrack = track;
break;
}
playFile->ReleaseTrack(track);
}
}
// Good relations with the Wookiees, I have.
+2 -1
View File
@@ -738,7 +738,8 @@ ScreenWindow::_UpdateRefreshControl()
if (item->Message()->FindFloat("refresh") == fSelected.refresh) {
item->SetMarked(true);
// "Other" items only contains a refresh rate when active
fOtherRefresh->SetLabel(B_TRANSLATE("Other" B_UTF8_ELLIPSIS));
if (fOtherRefresh != NULL)
fOtherRefresh->SetLabel(B_TRANSLATE("Other" B_UTF8_ELLIPSIS));
return;
}
}
@@ -1004,7 +1004,10 @@ TabView::MouseDown(BPoint where)
BRect fadeTabFrame(TabFrame(0));
BTab* modulesTab = TabAt(1);
BRect modulesTabFrame(TabFrame(1));
ModulesView* modulesView = dynamic_cast<ModulesView*>(modulesTab->View());
ModulesView* modulesView = NULL;
if (modulesTab != NULL)
modulesView = dynamic_cast<ModulesView*>(modulesTab->View());
if (fadeTab != NULL && Selection() != 0 && fadeTabFrame.Contains(where)
&& modulesView != NULL) {