fix file detection

This commit is contained in:
Eyck Jentzsch 2020-03-29 16:10:36 +02:00
parent 2aa4160400
commit 270a004037
4 changed files with 4 additions and 1 deletions

View File

@ -81,6 +81,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
@Override @Override
public boolean load(IWaveformDb db, File file) throws Exception { public boolean load(IWaveformDb db, File file) throws Exception {
if(file.isDirectory() || !file.exists()) return false;
this.db=db; this.db=db;
try { try {
FileInputStream fis = new FileInputStream(file); FileInputStream fis = new FileInputStream(file);

View File

@ -64,6 +64,7 @@ public class TextDbLoader implements IWaveformDbLoader{
@Override @Override
boolean load(IWaveformDb db, File file) throws Exception { boolean load(IWaveformDb db, File file) throws Exception {
if(file.isDirectory() || !file.exists()) return false;
this.db=db this.db=db
this.streams=[] this.streams=[]
try { try {

View File

@ -79,6 +79,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public boolean load(IWaveformDb db, File file) throws Exception { public boolean load(IWaveformDb db, File file) throws Exception {
if(file.isDirectory() || !file.exists()) return false;
this.db=db; this.db=db;
this.maxTime=0; this.maxTime=0;
String name = file.getCanonicalFile().getName(); String name = file.getCanonicalFile().getName();

View File

@ -669,7 +669,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
} }
if (filesToLoad.size() > 0) if (filesToLoad.size() > 0)
loadDatabase(persistedState); loadDatabase(persistedState);
if(partConfig instanceof String) { if(partConfig instanceof String && ((String)partConfig).length()>0) {
loadState((String) partConfig); loadState((String) partConfig);
} }
} }