修复了读取配置文件中在读取最后一行可能读取失败的问题

This commit is contained in:
jackfiled 2022-05-25 11:03:46 +08:00
parent e69d4ae1be
commit 8b4b560250

View File

@ -70,7 +70,7 @@ rail_node_t *ReadConfigFile()
}
// 讲道理,应该只有两位数,所以就这样处理了
if (*(p + 1) == '\n')
if (*(p + 1) == '\n' || *(p + 1) == '\0')
{
total_station = *p - 48;
}
@ -125,7 +125,7 @@ rail_node_t *ReadConfigFile()
p++;
}
if (*(p + 1) == '\n')
if (*(p + 1) == '\n' || *(p + 1) == '\0')
{
distance = *p - 48;
}