Skip to content
Snippets Groups Projects
Commit 003c7f0e authored by Steven Murray's avatar Steven Murray
Browse files

Preventing NULL optarg being assigned to std::string

parent 934c2994
Branches
Tags
No related merge requests found
......@@ -45,13 +45,13 @@ CreateAdminHostCmdLineArgs::CreateAdminHostCmdLineArgs(const int argc, char *con
while((opt = getopt_long(argc, argv, ":c:hn:", longopts, NULL)) != -1) {
switch(opt) {
case 'c':
comment = optarg;
comment = optarg ? optarg : "";
break;
case 'h':
help = true;
break;
case 'n':
adminHostname = optarg;
adminHostname = optarg ? optarg : "";
break;
case ':': // Missing parameter
{
......
......@@ -45,13 +45,13 @@ CreateAdminUserCmdLineArgs::CreateAdminUserCmdLineArgs(const int argc, char *con
while((opt = getopt_long(argc, argv, ":c:hu:", longopts, NULL)) != -1) {
switch(opt) {
case 'c':
comment = optarg;
comment = optarg ? optarg : "";
break;
case 'h':
help = true;
break;
case 'u':
adminUsername = optarg;
adminUsername = optarg ? optarg : "";
break;
case ':': // Missing parameter
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment