Commit 2f987219 authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook Github Bot 6

Properly report observable returning nullptr

Summary: Make sure exception is propagated to caller (especially when Observer is just created).

Reviewed By: yfeldblum

Differential Revision: D3798991

fbshipit-source-id: cee8452cfd40dcfbaf0e2ae2c2ee628af0362c6e
parent bd2c1914
...@@ -42,7 +42,9 @@ class ObserverCreator<Observable, Traits>::Context { ...@@ -42,7 +42,9 @@ class ObserverCreator<Observable, Traits>::Context {
void update() { void update() {
{ {
auto newValue = Traits::get(observable_); auto newValue = Traits::get(observable_);
DCHECK(newValue); if (!newValue) {
throw std::logic_error("Observable returned nullptr.");
}
value_.swap(newValue); value_.swap(newValue);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment