[Scummvm-cvs-logs] SF.net SVN: scummvm:[46748] tools/trunk/scummvm-tools-cli.cpp

jvprat at users.sourceforge.net jvprat at users.sourceforge.net
Wed Dec 30 16:08:40 CET 2009


Revision: 46748
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46748&view=rev
Author:   jvprat
Date:     2009-12-30 15:08:40 +0000 (Wed, 30 Dec 2009)

Log Message:
-----------
TOOLS/CLI: Fixed a crash when no tool name was passed to the --tool option.

Modified Paths:
--------------
    tools/trunk/scummvm-tools-cli.cpp

Modified: tools/trunk/scummvm-tools-cli.cpp
===================================================================
--- tools/trunk/scummvm-tools-cli.cpp	2009-12-30 15:01:54 UTC (rev 46747)
+++ tools/trunk/scummvm-tools-cli.cpp	2009-12-30 15:08:40 UTC (rev 46748)
@@ -54,14 +54,18 @@
 	std::string option = arguments.front();
 	if (option == "--tool" || option == "-t") {
 		arguments.pop_front();
-		for (ToolList::iterator iter = _tools.begin(); iter != _tools.end(); ++iter) {
-			Tool *tool = *iter;
-			if (arguments.front() == tool->getName()) {
-				// Run the tool, first argument will be name, very nice!
-				return tool->run(arguments);
+		if (arguments.size()) {
+			for (ToolList::iterator iter = _tools.begin(); iter != _tools.end(); ++iter) {
+				Tool *tool = *iter;
+				if (arguments.front() == tool->getName()) {
+					// Run the tool, first argument will be name, very nice!
+					return tool->run(arguments);
+				}
 			}
+			std::cout << "\tUnknown tool, make sure you input one of the following:" << std::endl;
+		} else {
+			std::cout << "\tMissing tool name, make sure you specify one of the following:" << std::endl;
 		}
-		std::cout << "\tUnknown tool, make sure you input one of the following:" << std::endl;
 		printTools();
 	} else if (option == "--help" || option == "-h") {
 		arguments.pop_front();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list