Skip to content

Bug: nil error on moving to next conflict when first opening the conflict file #91

@FredrikMorstad

Description

@FredrikMorstad

The problem 🐛

When I run cn my keymap for GitConflictNextConflict before pressing any key I get this error:
Screenshot 2024-07-09 at 00 09 40

Screen.Recording.2024-07-09.at.13.11.09.mov

Here I try running GitConflictNextConflict without pressing any key it and the error gets triggered, if I open it again and press j and the GitConflictNextConflict it works as expected

A quick fix 🩹

Change this to cover match.position being nil

if not match then return end

  if not match or match.positions == nil then return end

This does not handle the main problem that a key must be pressed for the visited_buffers[0].position to not be nil. I can make a PR for the quick fix, but I have to look more into why visited_buffers does not work when no key is pressed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions