Possible error in CDxfRead::DoRead: missing POLYLINE
stefan006 opened this issue · comments
There're two consecutive "0" lines in the DXF file. DoRead reads the first "0" and jumps into if(!strcmp(m_str, "0"))
, then reads the next line which is a "0" again. It jumps out of if(!strcmp(m_str, "0"))
and reads the next line which is "POLYLINE". It doesn't do anything with POLYLINE because it is outside of if(!strcmp(m_str, "0"))
This is part of my example file. I'm not allowed to post the whole file. This file has two POLYLINE. SEQEND is the end of the previous POLYLINE.
0
SEQEND
5
1328E9
8
0
0
POLYLINE
This is how I fixed it. It works for the few files I have. I don't know whether it breaks anything because I don't know the DXF format very well.
diff --git a/Application/core/dxf/dxf.cpp b/Application/core/dxf/dxf.cpp
index 18a85d9084..0998cafd86 100644
--- a/Application/core/dxf/dxf.cpp
+++ b/Application/core/dxf/dxf.cpp
@@ -2612,10 +2612,13 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */ )
{
if(!strcmp(m_str, "0"))
{
m_thickness = 0.0;
get_line();
+ while (!strcmp(m_str, "0"))
+ get_line();
+
if (!strcmp( m_str, "SECTION" )){
if(!ReadSection())
{
wprintf(wxT("CDxfRead::DoRead() Failed to read block\n"));
return;