zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
25.2k stars 1.18k forks source link

Runtime error after answering “yes” to save with sudo #1348

Open Igetin opened 5 years ago

Igetin commented 5 years ago

Description of the problem or steps to reproduce

  1. Open a file you don’t have write permission to
  2. Try to save the file
  3. Answer “y” to the prompt: Permission denied. Do you want to save this file using sudo?
  4. The program crashes and prints a message like this:
    
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal 0xb code=0x1 addr=0x4c pc=0x236db8]

goroutine 20 [running]: panic(0x5c0880, 0x10b26030) /usr/lib/go-1.6/src/runtime/panic.go:481 +0x330 github.com/zyedidia/micro/cmd/micro/vendor/github.com/zyedidia/tcell.(*tScreen).PollEvent(0x0, 0x0, 0x0) /build/b68dc646faa0c5dccca78d8c5d88c0fa-xenial/parts/micro/go/src/github.com/zyedidia/micro/cmd/micro/vendor/github.com/zyedidia/tcell/tscreen.go:801 +0x20 main.main.func5() /build/b68dc646faa0c5dccca78d8c5d88c0fa-xenial/parts/micro/go/src/github.com/zyedidia/micro/cmd/micro/micro.go:454 +0x3c created by main.main /build/b68dc646faa0c5dccca78d8c5d88c0fa-xenial/parts/micro/go/src/github.com/zyedidia/micro/cmd/micro/micro.go:457 +0x2400



The crash only occurs sometimes. I have not been able to pinpoint the cause.

I’m using micro over SSH.

## Specifications

Micro version: 1.4.0 (commit af520cf), installed via snap
OS: Raspbian 9.8 Stretch (Linux 4.14.98-v7+)
Hardware: Raspberry Pi 3B (revision 1.2)
ctnlaring commented 5 years ago

Just got a similar thing on Fedora 30. I'm not running over ssh and on a standard x86 machine Version: 1.4.1 Commit hash: 1856891 Compiled on August 10, 2018

https://pastebin.com/5c6mr6GY