Skip to content

Commit 5b32d46

Browse files
Fix parseCSMappingResult
1 parent 75fbdc4 commit 5b32d46

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pmacApp/src/pmacHardwarePower.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ std::string pmacHardwarePower::parseCSMappingResult(const std::string mappingRes
331331
static const char *functionName = "parseCSMappingResult";
332332
debugf(DEBUG_FLOW, functionName, "command %s", mappingResult.c_str());
333333

334-
if (mappingResult.length() > 0) {
335-
const char *mapping = mappingResult.substr(mappingResult.length() - 1, 1).c_str();
336-
char upper_mapping = (char) toupper(mapping[0]);
337-
result = std::string(1, upper_mapping);
334+
if (mappingResult.empty()) {
335+
return std::string();
338336
}
337+
char upper_mapping = (char) toupper(mappingResult.back());
338+
result = std::string(1,upper_mapping);
339339

340340
return result;
341341
}

0 commit comments

Comments
 (0)