Bug 340564

Summary: crash when opening an empty file
Product: [Applications] kdevelop Reporter: RJVB <rjvbertin>
Component: Plugin: Okteta IntegrationAssignee: Friedrich W. H. Kossebau <kossebau>
Status: RESOLVED FIXED    
Severity: crash CC: kdevelop-bugs-null
Priority: NOR    
Version First Reported In: 4.7.0   
Target Milestone: ---   
Platform: MacPorts   
OS: macOS   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description RJVB 2014-11-01 21:15:58 UTC
KDevelop crashes in Kasten2::ByteArrayView::init when trying to open an empty file, after clicking away the alert this file cannot be opened.

Reproducible: Always

Steps to Reproduce:
1. Open a project that contains an empty file.
2. Double-click that file in the Project toolview
3. Accept the dialog warning that the file cannot be opened

Actual Results:  
crash

Expected Results:  
No crash, and maybe a window on the empty file, ready to fill it.

This is the backtrace I get:

```
#0  0x0000000123cd0594 in Kasten2::ByteArrayView::init ()
#1  0x0000000123cd0b7b in Kasten2::ByteArrayView::ByteArrayView ()
#2  0x0000000123c91087 in KDevelop::OktetaView::OktetaView (this=0x13d9f7050, document=<value temporarily unavailable, due to optimizations>, viewProfileSynchronizer=0x13e64d440) at /Volumes/Debian/MP6/var/macports/build/_Volumes_Debian_MP6_site-ports_kde_kdevelop-git/kdevelop-git/work/kdevelop-git-4.7.0/utils/okteta/oktetaview.cpp:39
```
Comment 1 RJVB 2014-11-01 21:24:38 UTC
NB: the file in question is called Info.plist.template.orig, and was created by applying a patch to a project open in a running KDevelop session.
Empty files created through KDevelop do not cause a crash.
Comment 2 Kevin Funk 2016-09-08 10:26:07 UTC
Reproducible in 5.0?
Comment 3 RJVB 2016-09-08 10:43:09 UTC
No, not even with 4.7.3 in fact. Or it depends on the type of the empty file, which sadly I didn't record in my initial report.