Only call refreshViews if the VM service is available (#5474)

Fixes https://github.com/flutter/flutter/issues/5468
diff --git a/packages/flutter_tools/lib/src/run.dart b/packages/flutter_tools/lib/src/run.dart
index 9b0a35e..9a7c36a 100644
--- a/packages/flutter_tools/lib/src/run.dart
+++ b/packages/flutter_tools/lib/src/run.dart
@@ -185,8 +185,10 @@
 
     printStatus('Application running.');
 
-    await vmService.vm.refreshViews();
-    printStatus('Connected to view \'${vmService.vm.mainView}\'.');
+    if (vmService != null) {
+      await vmService.vm.refreshViews();
+      printStatus('Connected to view \'${vmService.vm.mainView}\'.');
+    }
 
     if (vmService != null && traceStartup) {
       printStatus('Downloading startup trace info...');