diff --git a/src/hm/HookManagerDriver.cc b/src/hm/HookManagerDriver.cc index 2f7cc94017..a0e708f1a1 100644 --- a/src/hm/HookManagerDriver.cc +++ b/src/hm/HookManagerDriver.cc @@ -170,7 +170,7 @@ void HookManagerDriver::protocol( { oss << "Error executing Hook: " << hook_name << ". " << info; - if ( info[0] != '-' ) + if ( !info.empty() && info[0] != '-' ) { vm->set_template_error_message(os.str()); vmpool->update(vm); diff --git a/src/tm/TransferManagerDriver.cc b/src/tm/TransferManagerDriver.cc index 5c44b131c1..29cefc49b1 100644 --- a/src/tm/TransferManagerDriver.cc +++ b/src/tm/TransferManagerDriver.cc @@ -144,7 +144,7 @@ void TransferManagerDriver::protocol( os.str(""); os << "Error excuting image transfer script"; - if (info[0] != '-') + if (!info.empty() && info[0] != '-') { os << ": " << info; diff --git a/src/vmm/VirtualMachineManagerDriver.cc b/src/vmm/VirtualMachineManagerDriver.cc index e5f9e3c1b1..1a753a0713 100644 --- a/src/vmm/VirtualMachineManagerDriver.cc +++ b/src/vmm/VirtualMachineManagerDriver.cc @@ -243,7 +243,7 @@ static void log_error(VirtualMachine* vm, os.str(""); os << msg; - if (info[0] != '-') + if (!info.empty() && info[0] != '-') { os << ": " << info; vm->set_template_error_message(os.str());