Podshot / MCEdit-Unified

Combined MCEdit & Pymclevel repository.
http://podshot.github.io/MCEdit-Unified/
ISC License
483 stars 109 forks source link

Rare "list index out of range" error with brush tool #894

Closed allamassal closed 6 years ago

allamassal commented 6 years ago

Title says enough. This is too confusing for me. EDIT: The error was just 3 lines in the console, one line pointing to the tools_brush.py file or whatever it is. Sadly I opened MCEdit again, overwriting the logfile, so I have to replicate this again to get the exact error.

Podshot commented 6 years ago

Could replicate the error again and give us the log file? We can't debug the issue without that information

allamassal commented 6 years ago

Okay, it just happened again. Let me copy the log file:

Traceback (most recent call last): File "mceutils.py", line 56, in _alertException File "editortools\brush.py", line 751, in mouseUp IndexError: list index out of range Any help would be a godsend at this point because I am working on a project that heavily uses the brush tool and I keep getting this error.

Isawan commented 6 years ago

What version are you using?

In the current master branch, this is the relevant function.

    def mouseUp(self, evt, pos, direction):
        """
        Called on releasing the Mouse Button.
        Creates Operation object and passes it to the leveleditor.
        """
        if not self.draggedPositions:
            return
        op = BrushOperation(self)
        self.editor.addOperation(op)
        if op.canUndo:
            self.editor.addUnsavedEdit()
        self.editor.invalidateBox(op.dirtyBox())
        self.lastPosition = self.draggedPositions[-1]
        self.draggedPositions = []

There's only one list access in this function where that error could be thrown. The only way for this to throw an out of range error is if the list has a length of zero, which I can't see happening with the check at the top of the function.

allamassal commented 6 years ago

I am using 1.5.6.0.

Podshot commented 6 years ago

@allamassal Which brush setting are you using?

allamassal commented 6 years ago

I was using the spherical brush setting, in Fill mode.

Isawan commented 6 years ago

I'm able to replicate the bug, haven't got it to happen consistently yet.

Podshot commented 6 years ago

Fixed via c71f53c