Asserting flashing plan is used in do_flash
Adding check to ensure flashing plan is used in do_flash. FlashingPlan
should never be null
Test: fastboot flashall -w
Change-Id: I8e69326c59b31c7b54d6d2e04c8ce5c0f12693a7
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index eee0e93..79c7169 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1489,10 +1489,13 @@
void do_flash(const char* pname, const char* fname, const bool apply_vbmeta,
const FlashingPlan* fp) {
+ if (!fp) {
+ die("do flash was called without a valid flashing plan");
+ }
verbose("Do flash %s %s", pname, fname);
struct fastboot_buffer buf;
- if (fp && fp->source) {
+ if (fp->source) {
unique_fd fd = fp->source->OpenFile(fname);
if (fd < 0 || !load_buf_fd(std::move(fd), &buf, fp)) {
die("could not load '%s': %s", fname, strerror(errno));