tool/CommandUpload.cpp
changeset 1826 ec6223c3b7ec
parent 1804 742607c464c4
child 1835 20748e9d2238
--- a/tool/CommandUpload.cpp	Tue Feb 23 17:40:46 2010 +0100
+++ b/tool/CommandUpload.cpp	Wed Feb 24 16:27:11 2010 +0100
@@ -32,6 +32,7 @@
 using namespace std;
 
 #include "CommandUpload.h"
+#include "MasterDevice.h"
 
 /*****************************************************************************/
 
@@ -81,7 +82,7 @@
 
 /****************************************************************************/
 
-void CommandUpload::execute(MasterDevice &m, const StringVector &args)
+void CommandUpload::execute(const StringVector &args)
 {
     SlaveList slaves;
     stringstream err, strIndex, strSubIndex;
@@ -113,6 +114,11 @@
     }
     data.sdo_entry_subindex = uval;
 
+    if (getMasterIndices().size() != 1) {
+        err << getName() << " requires to select a single master!";
+        throwInvalidUsageException(err);
+    }
+    MasterDevice m(getMasterIndices().front());
     m.open(MasterDevice::Read);
     slaves = selectedSlaves(m);
     if (slaves.size() != 1) {