Merge pull request #2619 from bootstraponline/read_file_fix

Check exists before read file
This commit is contained in:
Jonah
2014-05-20 17:13:58 -07:00

View File

@@ -375,8 +375,11 @@ androidController.getPageSource = function (cb) {
// Top level cb
function (err) {
if (err) return cb(err);
var xml = fs.readFileSync(xmlFile, 'utf8');
fs.unlinkSync(xmlFile);
var xml = '';
if (fs.existsSync(xmlFile)) {
xml = fs.readFileSync(xmlFile, 'utf8');
fs.unlinkSync(xmlFile);
}
try {
xml = _updateSourceXMLNodeNames(xml);
} catch (e) {