lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 366917f 1/2: Assert database filename not emp


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 366917f 1/2: Assert database filename not empty
Date: Fri, 5 May 2017 17:02:16 -0400 (EDT)

branch: master
commit 366917f6d560c39208270374dfa21d7f61213349
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Assert database filename not empty
    
    A database filename obtained from a '.policy' file was sometimes empty
    when running unit tests in parallel, because different tests wrote the
    same '.policy' file without synchronization. Before addressing the
    underlying problem, it seemed wise to trap this specific error.
---
 database.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/database.cpp b/database.cpp
index b785dcf..dcdcd48 100644
--- a/database.cpp
+++ b/database.cpp
@@ -199,7 +199,9 @@ void product_database::initialize(std::string const& 
product_name)
         }
     else
         {
-        std::string 
filename(product_data(product_name).datum("DatabaseFilename"));
+        product_data const p(product_name);
+        std::string const filename(p.datum("DatabaseFilename"));
+        LMI_ASSERT(!filename.empty());
         db_ = DBDictionary::read_via_cache(AddDataDir(filename));
         }
     maturity_age_ = static_cast<int>(Query(DB_MaturityAge));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]