[Libreoffice-commits] core.git: sc/source

Julien Nabet serval2412 at yahoo.fr
Sun Mar 4 17:07:48 UTC 2018


 sc/source/core/data/dbdocutl.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit a77b493392ecdfe2e58bb0fcfa7363a8583dffe4
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Mar 4 16:02:45 2018 +0100

    Related tdf#116171: don't try to convert empty value in timestamp
    
    Assert retrieved:
    warn:tools.datetime:3915:3915:tools/source/datetime/tdate.cxx:109: Date::setDateFromDMY - sure about 0 year? It's not in the calendar.
    soffice.bin: /home/julien/lo/libreoffice/tools/source/datetime/tdate.cxx:62: sal_Int32 {anonymous}::ImpYearToDays(sal_Int16): Assertion `nYear != 0' failed.
    
    Thread 1 "soffice.bin" received signal SIGABRT, Aborted.
    __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
    (gdb) bt
    0  0x00007ffff73a26a0 in __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    1  0x00007ffff73a3cf7 in __GI_abort () at abort.c:90
    2  0x00007ffff739afca in __assert_fail_base (fmt=0x7ffff74eb890 "%s%s%s:%u: %s%sAssertion `%s' failed.
    %n", assertion=assertion at entry=0x7fffed7d43a4 "nYear != 0", file=file at entry=0x7fffed7d4368 "/home/julien/lo/libreoffice/tools/source/datetime/tdate.cxx", line=line at entry=62, function=function at entry=0x7fffed7d4720 <(anonymous namespace)::ImpYearToDays(short)::__PRETTY_FUNCTION__> "sal_Int32 {anonymous}::ImpYearToDays(sal_Int16)") at assert.c:92
    3  0x00007ffff739b042 in __GI___assert_fail (assertion=0x7fffed7d43a4 "nYear != 0", file=0x7fffed7d4368 "/home/julien/lo/libreoffice/tools/source/datetime/tdate.cxx", line=62, function=0x7fffed7d4720 <(anonymous namespace)::ImpYearToDays(short)::__PRETTY_FUNCTION__> "sal_Int32 {anonymous}::ImpYearToDays(sal_Int16)") at assert.c:101
    4  0x00007fffed75e7e2 in (anonymous namespace)::ImpYearToDays(sal_Int16) (nYear=0) at /home/julien/lo/libreoffice/tools/source/datetime/tdate.cxx:62
    5  0x00007fffed75eeb5 in Date::DateToDays(unsigned short, unsigned short, short) (nDay=0, nMonth=0, nYear=0)
        at /home/julien/lo/libreoffice/tools/source/datetime/tdate.cxx:156
    6  0x00007fffed75ee6d in Date::GetAsNormalizedDays() const (this=0x7fffffff0318) at /home/julien/lo/libreoffice/tools/source/datetime/tdate.cxx:149
    7  0x00007fffed760342 in operator-(Date const&, Date const&) (rDate1=0-0-0, rDate2=1899-12-30) at /home/julien/lo/libreoffice/tools/source/datetime/tdate.cxx:609
    8  0x00007fffc7e8b705 in ScDatabaseDocUtil::PutData(ScDocument*, short, int, short, com::sun::star::uno::Reference<com::sun::star::sdbc::XRow> const&, long, long, bool, ScDatabaseDocUtil::StrData*) (pDoc=0x55555794c920, nCol=14, nRow=1, nTab=0, xRow=
        uno::Reference to (dbaccess::ORowSet *) 0x555557b5db08, nRowPos=15, nType=93, bCurrency=false, pStrData=0x7fffffff04b0)
        at /home/julien/lo/libreoffice/sc/source/core/data/dbdocutl.cxx:127
    9  0x00007fffc892e963 in ScDocShell::DBaseImport(rtl::OUString const&, unsigned short, std::__debug::map<short, ScColWidthParam, std::less<short>, std::allocator<std::pair<short const, ScColWidthParam> > >&, ScFlatBoolRowSegments&) (this=
        0x55555794c8c0, rFullFileName="/home/julien/lo/bugs/116171_dbffoxpro/addresses.dbf", eCharSet=63, aColWidthParam=std::__debug::map with 14 elements = {...}, rRowHeightsRecalc=...) at /home/julien/lo/libreoffice/sc/source/ui/docshell/docsh8.cxx:413
    
    Change-Id: I240ddd435c148360dc9a874913596b4844d726dc
    Reviewed-on: https://gerrit.libreoffice.org/50732
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>

diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx
index dc7c99c8f1f4..8c18a347f48f 100644
--- a/sc/source/core/data/dbdocutl.cxx
+++ b/sc/source/core/data/dbdocutl.cxx
@@ -124,14 +124,17 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
                                         SvNumFormatType::DATETIME, ScGlobal::eLnge );
 
                     util::DateTime aStamp = xRow->getTimestamp(nRowPos);
-                    nVal = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) -
-                                                pFormTable->GetNullDate() ) +
-                           aStamp.Hours       / static_cast<double>(::tools::Time::hourPerDay)   +
-                           aStamp.Minutes     / static_cast<double>(::tools::Time::minutePerDay) +
-                           aStamp.Seconds     / static_cast<double>(::tools::Time::secondPerDay) +
-                           aStamp.NanoSeconds / static_cast<double>(::tools::Time::nanoSecPerDay);
-                    bEmptyFlag = xRow->wasNull();
-                    bValue = true;
+                    if (aStamp.Year != 0)
+                    {
+                        nVal = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) -
+                                                    pFormTable->GetNullDate() ) +
+                               aStamp.Hours       / static_cast<double>(::tools::Time::hourPerDay)   +
+                               aStamp.Minutes     / static_cast<double>(::tools::Time::minutePerDay) +
+                               aStamp.Seconds     / static_cast<double>(::tools::Time::secondPerDay) +
+                               aStamp.NanoSeconds / static_cast<double>(::tools::Time::nanoSecPerDay);
+                        bEmptyFlag = xRow->wasNull();
+                        bValue = true;
+                    }
                 }
                 break;
 


More information about the Libreoffice-commits mailing list