Index: sky/viewer/internals.cc |
diff --git a/sky/viewer/internals.cc b/sky/viewer/internals.cc |
index 5edf79affc691598f4274f8550c0ada50d0d28a1..952fdc9439c9a7b11e72e4db213b5352950ebf43 100644 |
--- a/sky/viewer/internals.cc |
+++ b/sky/viewer/internals.cc |
@@ -39,7 +39,8 @@ gin::Handle<Internals> Internals::Create( |
Internals::Internals(DocumentView* document_view) |
: document_view_(document_view->GetWeakPtr()), |
shell_binding_(this) { |
- mojo::ConnectToService(document_view->imported_services(), &test_harness_); |
+ if (document_view_->imported_services()) |
+ mojo::ConnectToService(document_view_->imported_services(), &test_harness_); |
} |
Internals::~Internals() { |
@@ -74,13 +75,15 @@ std::string Internals::ContentAsText() { |
void Internals::NotifyTestComplete(const std::string& test_result) { |
std::vector<unsigned char> pixels; |
document_view_->GetPixelsForTesting(&pixels); |
- test_harness_->OnTestComplete(test_result, |
- mojo::Array<uint8_t>::From(pixels)); |
+ if (test_harness_) { |
+ test_harness_->OnTestComplete(test_result, |
+ mojo::Array<uint8_t>::From(pixels)); |
+ } |
} |
mojo::Handle Internals::ConnectToEmbedderService( |
const std::string& interface_name) { |
- if (!document_view_) |
+ if (!document_view_ || !document_view_->imported_services()) |
return mojo::Handle(); |
mojo::MessagePipe pipe; |