Skip to content

Commit 9750556

Browse files
committed
Careful to not construct string from NULL pointer.
1 parent 0e505ea commit 9750556

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Infrastructure/VM/src/ESMCI_VMKernel.C

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,7 +2541,10 @@ void *VMK::startup(class VMKPlan *vmp, void *(fctp)(void *, void *),
25412541
sarg[i].cargo = cargo;
25422542
// stdout and stderr redirect
25432543
string stdTemp; size_t pos; // temp helpers
2544-
stdTemp = string(vmp->stdoutName);
2544+
if (vmp->stdoutName)
2545+
stdTemp = string(vmp->stdoutName);
2546+
else
2547+
stdTemp = string("");
25452548
pos = stdTemp.rfind('*'); // right most asterisk
25462549
if (pos != string::npos){
25472550
// found wildcard -> replace with local pet number
@@ -2554,7 +2557,10 @@ void *VMK::startup(class VMKPlan *vmp, void *(fctp)(void *, void *),
25542557
// no wildcard -> use incoming string verbatim
25552558
sarg[i].stdoutName = stdTemp;
25562559
}
2557-
stdTemp = string(vmp->stderrName);
2560+
if (vmp->stderrName)
2561+
stdTemp = string(vmp->stderrName);
2562+
else
2563+
stdTemp = string("");
25582564
pos = stdTemp.rfind('*'); // right most asterisk
25592565
if (pos != string::npos){
25602566
// found wildcard -> replace with local pet number

0 commit comments

Comments
 (0)