Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: when episodes list is empty and right click the app crashes #25

Closed
lubiedo opened this issue Jan 21, 2021 · 1 comment · Fixed by #39
Closed

Issue: when episodes list is empty and right click the app crashes #25

lubiedo opened this issue Jan 21, 2021 · 1 comment · Fixed by #39
Milestone

Comments

@lubiedo
Copy link
Contributor

lubiedo commented Jan 21, 2021

Expected Behavior

Menu list appears and items should be disabled.

Current Behavior

Doughnut crashes with index out of range at EpisodeViewController.swift line 222.

Possible Solution

Bound check before setting the value to episode constant.

Steps to Reproduce

  1. Build Doughnut on commit c155192
  2. Run
  3. Right click on episodes list

Context (Environment)

N/A

Detailed Description

Backtrace:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = Fatal error: Index out of range
    frame #0: 0x00007fff2ca4d890 libswiftCore.dylib`_swift_runtime_on_report
    frame #1: 0x00007fff2cac7ef3 libswiftCore.dylib`_swift_stdlib_reportFatalErrorInFile + 211
    frame #2: 0x00007fff2c757030 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 480
    frame #3: 0x00007fff2c756b87 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 87
    frame #4: 0x00007fff2c756863 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 99
    frame #5: 0x00007fff2c7564d1 libswiftCore.dylib`Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 513
    frame #6: 0x00007fff2c738429 libswiftCore.dylib`Swift._ArrayBuffer._checkInoutAndNativeTypeCheckedBounds(_: Swift.Int, wasNativeTypeChecked: Swift.Bool) -> () + 249
    frame #7: 0x00007fff2c73d14e libswiftCore.dylib`Swift.Array.subscript.getter : (Swift.Int) -> A + 78
  * frame #8: 0x0000000109a2e8f5 Doughnut`EpisodeViewController.validateMenuItem(menuItem=0x0000600003f75d50, self=0x0000600002374370) at EpisodeViewController.swift:222:27
    frame #9: 0x0000000109a2f4f4 Doughnut`@objc EpisodeViewController.validateMenuItem(_:) at <compiler-generated>:0
    frame #10: 0x00007fff22e3ac5a AppKit`-[NSMenu _enableItem:] + 634
    frame #11: 0x00007fff22f87fe3 AppKit`-[NSCarbonMenuImpl _carbonUpdateStatusEvent:handlerCallRef:] + 437
    frame #12: 0x00007fff22f6e409 AppKit`NSSLMMenuEventHandler + 889
    frame #13: 0x00007fff286a84a0 HIToolbox`DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1431
    frame #14: 0x00007fff286a7879 HIToolbox`SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 329
    frame #15: 0x00007fff286bd18a HIToolbox`SendEventToEventTarget + 39
    frame #16: 0x00007fff2871d0d7 HIToolbox`SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 368
    frame #17: 0x00007fff2872cea8 HIToolbox`UpdateHICommandStatusWithCachedEvent + 51
    frame #18: 0x00007fff286a3ac6 HIToolbox`HIApplication::EventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 2574
    frame #19: 0x00007fff286a84a0 HIToolbox`DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1431
    frame #20: 0x00007fff286a7879 HIToolbox`SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 329
    frame #21: 0x00007fff286bd18a HIToolbox`SendEventToEventTarget + 39
    frame #22: 0x00007fff2885526e HIToolbox`SendEnableMenu(OpaqueEventTargetRef*, OpaqueMenuRef*, double, unsigned char, unsigned int) + 156
    frame #23: 0x00007fff2872c977 HIToolbox`SendMenuOpening(MenuSelectData*, MenuData*, double, unsigned int, unsigned int, __CFDictionary*, unsigned char, unsigned char*) + 599
    frame #24: 0x00007fff288534a9 HIToolbox`PopUpMenuSelectCore(MenuData*, Point, double, Point, unsigned short, unsigned int, unsigned int, Rect const*, unsigned short, unsigned int, Rect const*, Rect const*, __CFDictionary const*, __CFString const*, OpaqueMenuRef**, unsigned short*) + 835
    frame #25: 0x00007fff28852c7a HIToolbox`_HandlePopUpMenuSelection8(OpaqueMenuRef*, OpaqueEventRef*, unsigned int, Point, unsigned short, unsigned int, unsigned int, Rect const*, unsigned short, Rect const*, Rect const*, __CFDictionary const*, __CFString const*, OpaqueMenuRef**, unsigned short*) + 410
    frame #26: 0x00007fff28724db9 HIToolbox`_HandlePopUpMenuSelectionWithDictionary + 329
    frame #27: 0x00007fff23134ede AppKit`SLMPerformPopUpCarbonMenu + 2223
    frame #28: 0x00007fff22fd0e19 AppKit`_NSSLMPopUpCarbonMenu3 + 1096
    frame #29: 0x00007fff23072f7d AppKit`-[NSCarbonMenuImpl _popUpContextMenu:withEvent:forView:withFont:] + 208
    frame #30: 0x00007fff23072e09 AppKit`-[NSMenu _popUpContextMenu:withEvent:forView:withFont:] + 209
    frame #31: 0x00007fff234fad66 AppKit`-[NSView _showMenuForEvent:] + 85
    frame #32: 0x00007fff2306cfbb AppKit`-[NSView rightMouseDown:] + 100
    frame #33: 0x00007fff2319907b AppKit`-[NSControl _rightMouseUpOrDown:] + 493
    frame #34: 0x00007fff22df2f58 AppKit`-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 6482
    frame #35: 0x00007fff22df13ea AppKit`-[NSWindow(NSEventRouting) sendEvent:] + 347
    frame #36: 0x00007fff22df012a AppKit`-[NSApplication(NSEvent) sendEvent:] + 2742
    frame #37: 0x00000001099d9fca Doughnut`DoughnutApp.sendEvent(event=0x0000600002163180, self=0x00007fdf405055a0) at DoughnutApp.swift:44:11
    frame #38: 0x00000001099da094 Doughnut`@objc DoughnutApp.sendEvent(_:) at <compiler-generated>:0
    frame #39: 0x00007fff230c836e AppKit`-[NSApplication _handleEvent:] + 65
    frame #40: 0x00007fff22c58b2f AppKit`-[NSApplication run] + 623
    frame #41: 0x00007fff22c2cdf2 AppKit`NSApplicationMain + 816
    frame #42: 0x0000000109a37cbd Doughnut`main at AppDelegate.swift:23:7
    frame #43: 0x00007fff2036f621 libdyld.dylib`start + 1
    frame #44: 0x00007fff2036f621 libdyld.dylib`start + 1

Possible Implementation

N/A

@lubiedo
Copy link
Contributor Author

lubiedo commented Jan 21, 2021

As far as I've checked, this also happens in the podcast list whenever the right-click menu is shown without being focused on a show and actions like "Reload" are clicked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants