修复了读取配置文件中在读取最后一行可能读取失败的问题
This commit is contained in:
parent
e69d4ae1be
commit
8b4b560250
|
@ -70,7 +70,7 @@ rail_node_t *ReadConfigFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 讲道理,应该只有两位数,所以就这样处理了
|
// 讲道理,应该只有两位数,所以就这样处理了
|
||||||
if (*(p + 1) == '\n')
|
if (*(p + 1) == '\n' || *(p + 1) == '\0')
|
||||||
{
|
{
|
||||||
total_station = *p - 48;
|
total_station = *p - 48;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ rail_node_t *ReadConfigFile()
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(p + 1) == '\n')
|
if (*(p + 1) == '\n' || *(p + 1) == '\0')
|
||||||
{
|
{
|
||||||
distance = *p - 48;
|
distance = *p - 48;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user