Fix dm when --config not specified.

Broken by https://skia-review.googlesource.com/c/32862.

Change-Id: I711057da08793902b50e98b67af9107ac9ead8d2
Reviewed-on: https://skia-review.googlesource.com/33663
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <benjaminwagner@google.com>
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 6d35391..0644cc0 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -949,7 +949,7 @@
     return nullptr;
 }
 
-static bool gather_sinks(const GrContextOptions& grCtxOptions) {
+static bool gather_sinks(const GrContextOptions& grCtxOptions, bool defaultConfigs) {
     SkCommandLineConfigArray configs;
     ParseConfigs(FLAGS_config, &configs);
     for (int i = 0; i < configs.count(); i++) {
@@ -980,7 +980,9 @@
     }
 
     // If no configs were requested (just running tests, perhaps?), then we're okay.
-    if (configs.count() == 0 || FLAGS_config.count() == 0 ||
+    if (configs.count() == 0 ||
+        // If we're using the default configs, we're okay.
+        defaultConfigs ||
         // If we've been told to ignore undefined flags, we're okay.
         FLAGS_undefok ||
         // Otherwise, make sure that all specified configs have become sinks.
@@ -1337,7 +1339,16 @@
     if (!gather_srcs()) {
         return 1;
     }
-    if (!gather_sinks(grCtxOptions)) {
+    // TODO(dogben): This is a bit ugly. Find a cleaner way to do this.
+    bool defaultConfigs = true;
+    for (int i = 0; i < argc; i++) {
+        static const char* kConfigArg = "--config";
+        if (strcmp(argv[i], kConfigArg) == 0) {
+            defaultConfigs = false;
+            break;
+        }
+    }
+    if (!gather_sinks(grCtxOptions, defaultConfigs)) {
         return 1;
     }
     gather_tests();