[C++] Fix ckati -f
diff --git a/main.cc b/main.cc
index 9fa7954..93d665e 100644
--- a/main.cc
+++ b/main.cc
@@ -156,8 +156,6 @@
 #endif
     } else if (Exists("Makefile")) {
       g_makefile = "Makefile";
-    } else {
-      ERROR("*** No targets specified and no makefile found.");
     }
   }
 }
@@ -335,6 +333,8 @@
   vector<Symbol> targets;
   vector<StringPiece> cl_vars;
   ParseCommandLine(argc, argv, &targets, &cl_vars);
+  if (g_makefile == NULL)
+    ERROR("*** No targets specified and no makefile found.");
   // This depends on command line flags.
   if (g_use_find_emulator)
     InitFindEmulator();