Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/data/molecules/MoleculeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Molecule } from 'openchemlib';
import type { StateMolecule, StateMoleculeExtended } from './Molecule.js';
import { initMolecule } from './Molecule.js';

//TODO: Move molecule initialization to nmrium-core and log an error if the molecule cannot be parsed.
export function fromJSON(
mols: StateMolecule[],
reservedMolecules: StateMolecule[] = [],
Expand All @@ -13,6 +14,13 @@ export function fromJSON(
const molecules: StateMoleculeExtended[] = [];
for (const mol of mols) {
const molecule = Molecule.fromMolfile(mol.molfile);

const atomCount = molecule.getAllAtoms();

if (atomCount === 0) {
continue;
}

molecules.push(
initMolecule({
molfile: molecule.toMolfileV3(),
Expand Down
Loading