Skip to content

Commit

Permalink
SKA-483: check if the read file is empty in advalues mode (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
VKyllianAubry authored and GitHub Enterprise committed May 6, 2024
1 parent afce11e commit af36e63
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions advalues/adapter/AdAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ auto AdAdapter::Serialize() -> std::vector<uint8_t>
SilKit::Util::SerDes::Serializer serializer;

std::string str(_bufferFromChardev.begin(), _bufferFromChardev.end());

// Check if the file read is empty
if ((str == "") || (str[0] == '\n'))
{
_logger->Warn(_pathToCharDev + " is empty");
return std::vector<uint8_t>{};
}

try
{
switch (_dataType)
Expand Down

0 comments on commit af36e63

Please sign in to comment.