| 297 | 297 | try { |
| 298 | 298 | const optionsUrl = urlJoin(request.body.url, '/sdapi/v1/options'); |
| 299 | 299 | const optionsResult = await fetch(optionsUrl, { headers: { 'Authorization': getBasicAuthHeader(request.body.auth) } }); |
| 300 | | - const optionsData = /** @type {any} */ (await optionsResult.json()); |
| 300 | + if (optionsResult.ok) { |
| 301 | | - const isForge = 'forge_preset' in optionsData; |
| 301 | + const optionsData = /** @type {any} */ (await optionsResult.json()); |
| 302 | + const isForge = 'forge_preset' in optionsData; |
| 302 | 303 | |
| 303 | 304 | if (!isForge) { |
| 304 | 305 | _.unset(request.body, 'override_settings.forge_additional_modules'); |
| 306 | + } |
| 305 | 307 | } |
| 306 | 308 | } catch (error) { |
| 307 | 309 | console.log('SD WebUI failed to get options:', error); |