Skip to content

Commit

Permalink
fixed crash if dependency is missing reference
Browse files Browse the repository at this point in the history
that shouldn't be possible and afaict has only been reported once

fixes #14351
  • Loading branch information
TanninOne committed May 23, 2023
1 parent de4797a commit f33502a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/extensions/mod_management/InstallManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,7 @@ class InstallManager {
: this.withInstructions(api,
modName(sourceMod),
renderModReference(dep.reference),
dep.reference.tag ?? downloadId,
dep.reference?.tag ?? downloadId,
dep.extra?.['instructions'],
recommended, () =>
this.installModAsync(dep.reference, api, downloadId,
Expand Down
6 changes: 5 additions & 1 deletion src/extensions/mod_management/util/modName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ export interface IRenderOptions {
version?: boolean;
}

export function renderModReference(ref: IModReference, mod?: IMod, options?: IRenderOptions) {
export function renderModReference(ref?: IModReference, mod?: IMod, options?: IRenderOptions) {
const version = (options === undefined) || options.version !== false;

if (mod !== undefined) {
return modName(mod, { version });
}

if (ref === undefined) {
return '<Invalid reference>';
}

if (ref.description !== undefined) {
return ref.description;
}
Expand Down

0 comments on commit f33502a

Please sign in to comment.