diff --git a/SPID/include/FormData.h b/SPID/include/FormData.h index 3d46c05..aef1856 100644 --- a/SPID/include/FormData.h +++ b/SPID/include/FormData.h @@ -37,13 +37,13 @@ namespace Forms /// struct MismatchingFormTypeException : std::exception { - const RE::FormType expectedFformType; + const RE::FormType expectedFormType; const RE::FormType actualFormType; const FormOrEditorID formOrEditorID; const std::string path; - MismatchingFormTypeException(RE::FormType expectedFformType, RE::FormType actualFormType, const FormOrEditorID& formOrEditorID, const std::string& path) : - expectedFformType(expectedFformType), + MismatchingFormTypeException(RE::FormType expectedFormType, RE::FormType actualFormType, const FormOrEditorID& formOrEditorID, const std::string& path) : + expectedFormType(expectedFormType), actualFormType(actualFormType), formOrEditorID(formOrEditorID), path(path) @@ -216,8 +216,10 @@ namespace Forms } form = as_form(anyForm); - if (!form) { - throw MismatchingFormTypeException(anyForm->GetFormType(), Form::FORMTYPE, FormModPair{ *formID, modName }, path); + if (!form || anyForm->GetFormType() != Form::FORMTYPE) { + // Ideally, we'd want to throw separate exception for unsupported form type, + // so that attempting to distribute, for example, CELL would properly report such error. + throw MismatchingFormTypeException(Form::FORMTYPE, anyForm->GetFormType(), FormModPair{ *formID, modName }, path); } if constexpr (std::is_same_v