Skip to content

Commit

Permalink
Merge pull request #8654 from brave/ntp_bg_img_svc_fix
Browse files Browse the repository at this point in the history
Fix crash on null NTPBackgroundImagesService
  • Loading branch information
wchen342 authored Apr 27, 2021
2 parents 28521e3 + f3f1bd8 commit da4f804
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ NTPBackgroundImagesBridge::NTPBackgroundImagesBridge(Profile* profile)
java_object_.Reset(Java_NTPBackgroundImagesBridge_create(
AttachCurrentThread(), reinterpret_cast<intptr_t>(this)));

background_images_service_->AddObserver(this);
if (background_images_service_)
background_images_service_->AddObserver(this);
}

NTPBackgroundImagesBridge::~NTPBackgroundImagesBridge() {
background_images_service_->RemoveObserver(this);
if (background_images_service_)
background_images_service_->RemoveObserver(this);
Java_NTPBackgroundImagesBridge_destroy(AttachCurrentThread(), java_object_);
}

Expand Down

0 comments on commit da4f804

Please sign in to comment.