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; int32 index;
if (!message && ((index = IndexOf(point)) >= 0)) { if (!message && ((index = IndexOf(point)) >= 0)) {
DormantNodeListItem *item = dynamic_cast<DormantNodeListItem *>(ItemAt(index)); DormantNodeListItem *item =
DormantNodeListItem *last = dynamic_cast<DormantNodeListItem *>(m_lastItemUnder); dynamic_cast<DormantNodeListItem *>(ItemAt(index));
BRect r = item->getRealFrame(be_plain_font); DormantNodeListItem *last =
if (item && r.Contains(point)) { dynamic_cast<DormantNodeListItem *>(m_lastItemUnder);
if (item != last) { if (item != NULL) {
if (last) BRect r = item->getRealFrame(be_plain_font);
last->MouseOver(this, point, B_EXITED_VIEW); if (r.Contains(point)) {
item->MouseOver(this, point, B_ENTERED_VIEW); if (item != last) {
m_lastItemUnder = item; if (last != NULL)
} last->MouseOver(this, point, B_EXITED_VIEW);
else { item->MouseOver(this, point, B_ENTERED_VIEW);
item->MouseOver(this, point, B_INSIDE_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); 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 // find a couple of important views and mess with their layout
BView* background = Window()->ChildAt(0); BView* background = Window()->ChildAt(0);
if (background == NULL) {
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
return;
}
BButton* cancel = dynamic_cast<BButton*>( BButton* cancel = dynamic_cast<BButton*>(
background->FindView("cancel button")); background->FindView("cancel button"));
BView* textview = background->FindView("text view"); BView* textview = background->FindView("text view");
BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>( BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(
background->FindView("HScrollBar")); background->FindView("HScrollBar"));
if (!background || !cancel || !textview || !hscrollbar) { if (!cancel || !textview || !hscrollbar) {
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n"); printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
return; return;
} }
+4 -3
View File
@@ -14,10 +14,11 @@ KUndoItem::KUndoItem(const char* redo_text, int32 length, int32 offset,
if (redo_text != NULL) { if (redo_text != NULL) {
RedoText = (char*)malloc(length); RedoText = (char*)malloc(length);
memcpy(RedoText, redo_text, length);
if (RedoText != NULL) if (RedoText != NULL) {
memcpy(RedoText, redo_text, length);
fStatus = B_OK; fStatus = B_OK;
else } else
fStatus = B_ERROR; fStatus = B_ERROR;
} }
} }
+1 -1
View File
@@ -329,7 +329,7 @@ ScopeView::MouseDown(BPoint position)
void void
ScopeView::InitBitmap() ScopeView::InitBitmap()
{ {
if (fBitmapView) { if (fBitmap != NULL && fBitmapView != NULL) {
fBitmap->RemoveChild(fBitmapView); fBitmap->RemoveChild(fBitmapView);
delete 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++) { for (int i = 0; i < playFile->CountTracks(); i++) {
BMediaTrack* track = playFile->TrackAt(i); BMediaTrack* track = playFile->TrackAt(i);
playFormat.type = B_MEDIA_RAW_AUDIO; if (track != NULL) {
if ((track->DecodedFormat(&playFormat) == B_OK) playFormat.type = B_MEDIA_RAW_AUDIO;
if ((track->DecodedFormat(&playFormat) == B_OK)
&& (playFormat.type == B_MEDIA_RAW_AUDIO)) { && (playFormat.type == B_MEDIA_RAW_AUDIO)) {
playTrack = track; playTrack = track;
break; break;
} }
if (track)
playFile->ReleaseTrack(track); playFile->ReleaseTrack(track);
}
} }
// Good relations with the Wookiees, I have. // Good relations with the Wookiees, I have.
+2 -1
View File
@@ -738,7 +738,8 @@ ScreenWindow::_UpdateRefreshControl()
if (item->Message()->FindFloat("refresh") == fSelected.refresh) { if (item->Message()->FindFloat("refresh") == fSelected.refresh) {
item->SetMarked(true); item->SetMarked(true);
// "Other" items only contains a refresh rate when active // "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; return;
} }
} }
@@ -1004,7 +1004,10 @@ TabView::MouseDown(BPoint where)
BRect fadeTabFrame(TabFrame(0)); BRect fadeTabFrame(TabFrame(0));
BTab* modulesTab = TabAt(1); BTab* modulesTab = TabAt(1);
BRect modulesTabFrame(TabFrame(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) if (fadeTab != NULL && Selection() != 0 && fadeTabFrame.Contains(where)
&& modulesView != NULL) { && modulesView != NULL) {