Commit 27af9326 authored by Ilya Kirillov's avatar Ilya Kirillov

Fix bug #32589 Исправлен баг с чтением документов, у которых стоит флаг...

Fix bug #32589 Исправлен баг с чтением документов, у которых стоит флаг "колонки разной ширины", но при этом ни одной колонки не задано.
parent c5072d9a
...@@ -1888,8 +1888,8 @@ CSectionColumn.prototype.Write_ToBinary = function(Writer) ...@@ -1888,8 +1888,8 @@ CSectionColumn.prototype.Write_ToBinary = function(Writer)
// Double : W // Double : W
// Double : Space // Double : Space
Writer.WriteDouble( this.W ); Writer.WriteDouble(this.W);
Writer.WriteDouble( this.Space ); Writer.WriteDouble(this.Space);
}; };
CSectionColumn.prototype.Read_FromBinary = function(Reader) CSectionColumn.prototype.Read_FromBinary = function(Reader)
{ {
...@@ -1921,15 +1921,15 @@ CSectionColumns.prototype.Write_ToBinary = function(Writer) ...@@ -1921,15 +1921,15 @@ CSectionColumns.prototype.Write_ToBinary = function(Writer)
// Long : Количество колонок // Long : Количество колонок
// Variable : Сами колонки // Variable : Сами колонки
Writer.WriteBool( this.EqualWidth ); Writer.WriteBool(this.EqualWidth);
Writer.WriteLong( this.Num ); Writer.WriteLong(this.Num);
Writer.WriteBool( this.Sep ); Writer.WriteBool(this.Sep);
Writer.WriteDouble( this.Space ); Writer.WriteDouble(this.Space);
var Count = this.Cols.length; var Count = this.Cols.length;
Writer.WriteLong( Count ); Writer.WriteLong(Count);
for ( var Pos = 0; Pos < Count; Pos++ ) for (var Pos = 0; Pos < Count; Pos++)
{ {
this.Cols[Pos].Write_ToBinary(Writer); this.Cols[Pos].Write_ToBinary(Writer);
} }
...@@ -1952,18 +1952,25 @@ CSectionColumns.prototype.Read_FromBinary = function(Reader) ...@@ -1952,18 +1952,25 @@ CSectionColumns.prototype.Read_FromBinary = function(Reader)
var Count = Reader.GetLong(); var Count = Reader.GetLong();
this.Cols = []; this.Cols = [];
for ( var Pos = 0; Pos < Count; Pos++ ) for (var Pos = 0; Pos < Count; Pos++)
{ {
this.Cols[Pos] = new CSectionColumn(); this.Cols[Pos] = new CSectionColumn();
this.Cols[Pos].Read_FromBinary( Reader ); this.Cols[Pos].Read_FromBinary(Reader);
} }
}; };
CSectionColumns.prototype.Get_Count = function() CSectionColumns.prototype.Get_Count = function()
{ {
if (true === this.EqualWidth) if (true === this.EqualWidth)
{
return this.Num; return this.Num;
}
else else
{
if (this.Cols.length <= 0)
return 1;
return this.Cols.length; return this.Cols.length;
}
}; };
CSectionColumns.prototype.Get_ColumnWidth = function(ColIndex) CSectionColumns.prototype.Get_ColumnWidth = function(ColIndex)
{ {
...@@ -1976,6 +1983,9 @@ CSectionColumns.prototype.Get_ColumnWidth = function(ColIndex) ...@@ -1976,6 +1983,9 @@ CSectionColumns.prototype.Get_ColumnWidth = function(ColIndex)
} }
else else
{ {
if (this.Cols.length <= 0)
return 0;
ColIndex = Math.max(0, Math.min(this.Cols.length - 1, ColIndex)); ColIndex = Math.max(0, Math.min(this.Cols.length - 1, ColIndex));
if (ColIndex < 0) if (ColIndex < 0)
return 0; return 0;
...@@ -1991,6 +2001,9 @@ CSectionColumns.prototype.Get_ColumnSpace = function(ColIndex) ...@@ -1991,6 +2001,9 @@ CSectionColumns.prototype.Get_ColumnSpace = function(ColIndex)
} }
else else
{ {
if (this.Cols.length <= 0)
return this.Space;
ColIndex = Math.max(0, Math.min(this.Cols.length - 1, ColIndex)); ColIndex = Math.max(0, Math.min(this.Cols.length - 1, ColIndex));
if (ColIndex < 0) if (ColIndex < 0)
return this.Space; return this.Space;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment