Fixed an egregious error introduced by the "save <file>.tcl"
command handling in the previous commit, that can cause a crash whenever "writeall" is called while a cell's filename is still NULL. Thanks to Daniel Estevez for reporting the error.
This commit is contained in:
parent
59a1953f3c
commit
6195c20d3d
|
|
@ -4269,25 +4269,27 @@ DBCellWrite(cellDef, fileName)
|
||||||
|
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
|
|
||||||
/* Feature added 9/4/2025: If the filename ends with ".tcl",
|
if (fileName)
|
||||||
* then write the cell as a series of magic commands, and don't
|
|
||||||
* otherwise alter the cell.
|
|
||||||
*/
|
|
||||||
if ((strlen(fileName) > 4) && (!strcmp(fileName + strlen(fileName) - 4, ".tcl")))
|
|
||||||
{
|
{
|
||||||
if ((realf = fopen(fileName, "w")))
|
/* Feature added 9/4/2025: If the filename ends with ".tcl",
|
||||||
|
* then write the cell as a series of magic commands, and don't
|
||||||
|
* otherwise alter the cell.
|
||||||
|
*/
|
||||||
|
if ((strlen(fileName) > 4) && (!strcmp(fileName + strlen(fileName) - 4, ".tcl")))
|
||||||
{
|
{
|
||||||
result = DBCellWriteCommandFile(cellDef, realf);
|
if ((realf = fopen(fileName, "w")))
|
||||||
fclose(realf);
|
{
|
||||||
return result;
|
result = DBCellWriteCommandFile(cellDef, realf);
|
||||||
|
fclose(realf);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/*
|
|
||||||
* Figure out the name of the file we will eventually write.
|
|
||||||
*/
|
|
||||||
if (!fileName)
|
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Figure out the name of the file we will eventually write.
|
||||||
|
*/
|
||||||
if (cellDef->cd_file)
|
if (cellDef->cd_file)
|
||||||
fileName = cellDef->cd_file;
|
fileName = cellDef->cd_file;
|
||||||
else if (cellDef->cd_name)
|
else if (cellDef->cd_name)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue