Resolve bug in preset handler if the filepath hasn't been set by setup

This commit is contained in:
Logan Cusano
2024-05-13 00:50:08 -04:00
parent c51190f6b6
commit 5d32a5131a

View File

@@ -75,6 +75,9 @@ const convertFrequencyToHertz = async (frequency) => {
* @returns {any} The object containing the different systems the bot is near
*/
export const getAllPresets = () => {
// If the config path hasn't been set by setup
if (!configFilePath) return {};
const presetDir = resolve(configFilePath);
console.log(`Getting presets from directory: '${presetDir}'`);
if (existsSync(presetDir)) return JSON.parse(readFileSync(presetDir));