@Override
public synchronized String[] getStructureFiles()
{
- List<String> mset = new ArrayList<>();
if (jmolViewer == null)
{
return new String[0];
{
int modelCount = jmolViewer.ms.mc;
String filePath = null;
+ List<String> mset = new ArrayList<>();
for (int i = 0; i < modelCount; ++i)
{
+ /*
+ * defensive check for null as getModelFileName can return null
+ * even when model count ms.mc is > 0
+ */
filePath = jmolViewer.ms.getModelFileName(i);
- if (!mset.contains(filePath))
+ if (filePath != null && !mset.contains(filePath))
{
mset.add(filePath);
}