Skip to content

raindrops: panic on for loop without condition #7

Description

@bitfield

This solution breaks Exalysis, and presumably now also go-analyzer. Here's the problem:

	for {
		...
	}

In examExtensiveForLoop, this code assumes that every for loop will have a condition:

		if loop.Cond().FindFirstByName(paramName) != nil {
			...
		}

In this case, loop.Cond() is nil:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa0 pc=0x1466eed]

goroutine 1 [running]:
github.com/exercism/exalysis/track/raindrops.examExtensiveForLoop(0xc0000d0140, 0xc0001d20c0)
        /Users/john/git/bitfield/exalysis/track/raindrops/raindrops.go:116 +0x16d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions