Index: extensions/browser/extension_function.h |
diff --git a/extensions/browser/extension_function.h b/extensions/browser/extension_function.h |
index f4ffaa273afe5e96007c9a93b7eed5444f87844a..2a933ab37e0e55ff7dd1b590a1a3c653a6624816 100644 |
--- a/extensions/browser/extension_function.h |
+++ b/extensions/browser/extension_function.h |
@@ -218,7 +218,14 @@ class ExtensionFunction |
extension_ = extension; |
} |
const extensions::Extension* extension() const { return extension_.get(); } |
- const std::string& extension_id() const { return extension_->id(); } |
+ const std::string& extension_id() const { |
+ DCHECK(extension()) |
+ << "extension_id() called without an Extension. If " << name() |
+ << " is allowed to be called without any Extension then you should " |
+ << "check extension() first. If not, there is a bug in the Extension " |
+ << "platform, so page somebody in extensions/OWNERS"; |
+ return extension_->id(); |
+ } |
void set_request_id(int request_id) { request_id_ = request_id; } |
int request_id() { return request_id_; } |