Modifying a library without write access in LibEdit causes KiCAD to crash immediately on saving

Trying to modify a symbol library which has different owner than the user running LibEdit and trying to save it causes KiCAD to immediately crash. Only tested on file belonging to root:root. Some indication that the file could not be saved would be really great.

Description

Steps to reproduce

  1. Open a library in LibEdit which belongs to other user (in Ubuntu, the files belong to root:root by default if installed from system repositories). The user which is running KiCAD must not have write permission to the file.
  2. Make any change to the library, for example delete one pin.
  3. Save the library.
  4. KiCAD has immediately crashed.

KiCad Version

Application: KiCad
Version: 5.99.0-unknown-6252493~100~ubuntu19.10.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.65.3 OpenSSL/1.1.1c zlib/1.2.11 libidn2/2.2.0 libpsl/0.20.2 (+libidn2/2.0.5) libssh/0.9.0/openssl/zlib nghttp2/1.39.2 librtmp/2.3
Platform: Linux 5.3.0-40-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    Build date: Feb 19 2020 12:47:37
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.67.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.65.3
    Compiler: GCC 9.2.1 with C++ ABI 1013

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON