Fixed a bug in the new feature of $readmem[hb] when an empty string is provided

Signed-off-by: Rodrigo Alejandro Melo <rodrigomelo9@gmail.com>
This commit is contained in:
Rodrigo Alejandro Melo 2020-02-01 17:03:56 -03:00
parent d74b9604e3
commit b4c30cfc8d
1 changed files with 1 additions and 1 deletions

View File

@ -2894,7 +2894,7 @@ AstNode *AstNode::readmem(bool is_readmemh, std::string mem_filename, AstNode *m
} else {
yosys_input_files.insert(mem_filename);
}
if (f.fail())
if (f.fail() || strlen(mem_filename.c_str()) == 0)
log_file_error(filename, linenum, "Can not open file `%s` for %s.\n", mem_filename.c_str(), str.c_str());
log_assert(GetSize(memory->children) == 2 && memory->children[1]->type == AST_RANGE && memory->children[1]->range_valid);