Skip to content

Commit

Permalink
fix(handleForm): add optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri authored Jul 22, 2023
1 parent 9c509a0 commit dfb2372
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/client/src/util/handleForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import { setVariable } from "./utils";
export const handleForm = async (file: Record<string, unknown>) => {
const cpuModel = document.querySelector("#cpu_model") as HTMLSelectElement,
ocVersion = document.querySelector("#oc_version") as HTMLSelectElement,
cpuValue = cpuModel.options[cpuModel.selectedIndex].value,
cpuName = cpuModel.options[cpuModel.selectedIndex].text,
ocValue = ocVersion.options[ocVersion.selectedIndex].value;

cpuValue = cpuModel.options[cpuModel.selectedIndex]?.value,
cpuName = cpuModel.options[cpuModel.selectedIndex]?.text,
ocValue = ocVersion?.options[ocVersion.selectedIndex]?.value;
const uuid = await getIdentificator();

if (!cpuValue || cpuValue === "default" || !cpuName || !ocValue) return { success: false, error: "Please select CPU model and OpenCore version" };
Expand Down

0 comments on commit dfb2372

Please sign in to comment.