Make it impossible to crash app while extruding (#2224)

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
Frank Noirot
2024-04-24 16:34:56 -04:00
committed by GitHub
parent 2fc7c0d5fd
commit cc6dee8ad4
4 changed files with 30 additions and 24 deletions

View File

@ -267,10 +267,12 @@ export const ModelingMachineProvider = ({
'has valid extrude selection': ({ selectionRanges }) => {
// A user can begin extruding if they either have 1+ faces selected or nothing selected
// TODO: I believe this guard only allows for extruding a single face at a time
if (selectionRanges.codeBasedSelections.length < 1) return false
const isPipe = isSketchPipe(selectionRanges)
if (isSelectionLastLine(selectionRanges, codeManager.code))
if (
selectionRanges.codeBasedSelections.length === 0 ||
isSelectionLastLine(selectionRanges, codeManager.code)
)
return true
if (!isPipe) return false