From 9d874c5cd68073920356e5184f3eb4c91076a003 Mon Sep 17 00:00:00 2001 From: Damien Dupuis Date: Thu, 4 Mar 2010 09:59:51 +0000 Subject: [PATCH] Bug correction: _sinzing variable was not default initialized to NULL, which make nwidget core dumps --- vlsisapd/openChams/Circuit.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vlsisapd/openChams/Circuit.cpp b/vlsisapd/openChams/Circuit.cpp index fbd68c14..c7d1b807 100644 --- a/vlsisapd/openChams/Circuit.cpp +++ b/vlsisapd/openChams/Circuit.cpp @@ -36,7 +36,7 @@ static bool readNetsDone = false; static bool readSchematicDone = false; static bool readSizingDone = false; -Circuit::Circuit(Name name, Name techno) : _name(name), _techno(techno), _netlist(NULL), _schematic(NULL) { +Circuit::Circuit(Name name, Name techno) : _name(name), _techno(techno), _netlist(NULL), _schematic(NULL), _sizing(NULL) { readCircuitParametersDone = false; readNetListDone = false; readInstancesDone = false; @@ -603,19 +603,25 @@ Circuit* Circuit::readFromFile(const string filePath) { bool Circuit::writeToFile(string filePath) { ofstream file; file.open(filePath.c_str()); + if (!file.is_open()) { + string error("[ERROR] Cannot open file "); + error += filePath; + error += " for writting."; + throw OpenChamsException(error); + } // checks before do anything if (!_netlist) { - cerr << "no netlist" << endl; cerr.flush(); + //cerr << "no netlist" << endl; cerr.flush(); throw OpenChamsException("[ERROR] Cannot writeToFile since no netlist is defined !"); //return false; } if (_netlist->hasNoInstances()) { - cerr << "no instances" << endl; cerr.flush(); + //cerr << "no instances" << endl; cerr.flush(); throw OpenChamsException("[ERROR] Cannot writeToFile since no instance is defined in netlist !"); //return false; } if (_netlist->hasNoNets()) { - cerr << "no nets" << endl; cerr.flush(); + //cerr << "no nets" << endl; cerr.flush(); throw OpenChamsException("[ERROR] Cannot writeToFile since no net is defined in netlist !"); //return false; }