Edouard127 / reddit-placebot-2023

A bot for r/place that doesn't use the api
MIT License
87 stars 15 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #95

Closed bartley20 closed 1 year ago

bartley20 commented 1 year ago

I've got the Tor expert bundle running, setup my users.json, but when I go to run the script, immediately after I get the 'Login Successful' message, I get this panic message and the script stops. Any ideas whats going on?

2023-07-24T16:59:00.438-0500    INFO    reddit-placebot-2023/client.go:50       Login successful        {"username": "throwaway3034034"}
Login finished!
2023-07-24T16:59:01.202-0500    INFO    reddit-placebot-2023/board.go:55        Controller changed      {"username": "throwaway3034034"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x13aa796]

goroutine 1 [running]:
main.(*Board).GetDifferentData(0xc0000b1d00)
        /Users/user/Tools/reddit-placebot-2023/board.go:43 +0xb6
main.(*Worker).Run(0xc0000b1d40)
        /Users/user/Tools/reddit-placebot-2023/worker.go:37 +0x58
main.main()
        /Users/user/Tools/reddit-placebot-2023/main.go:47 +0x5cf
Obelisx commented 1 year ago

What did you do to fix this?

My log looks similar, except it fails to log in also. The json is filled in correctly:

main.(*Client).Login
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/client.go:69
main.main.func1
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:33
2023-07-25T00:52:17.611+0200    ERROR   reddit-placebot-2023-master/client.go:69        Login failed    {"username": "", "username": ""}
main.(*Client).Login
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/client.go:69
main.main.func1
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:33
Login finished!
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0x50a3cf]

goroutine 1 [running]:
main.(*Board).GetDifferentData(0xa04b020)
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/board.go:43 +0x7f
main.(*Worker).Run(0xa025d60)
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/worker.go:37 +0x4e
main.main()
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:47 +0x5b8
bartley20 commented 1 year ago

What did you do to fix this?

My log looks similar, except it fails to log in also. The json is filled in correctly:

main.(*Client).Login
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/client.go:69
main.main.func1
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:33
2023-07-25T00:52:17.611+0200    ERROR   reddit-placebot-2023-master/client.go:69        Login failed    {"username": "", "username": ""}
main.(*Client).Login
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/client.go:69
main.main.func1
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:33
Login finished!
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0x50a3cf]

goroutine 1 [running]:
main.(*Board).GetDifferentData(0xa04b020)
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/board.go:43 +0x7f
main.(*Worker).Run(0xa025d60)
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/worker.go:37 +0x4e
main.main()
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:47 +0x5b8

It was my BMP file. I would try using a different image. When I used a different image and https://products.aspose.app/imaging/image-editor/bmp to scale the BMP down to 32x32, the error went away

Obelisx commented 1 year ago

What did you do to fix this? My log looks similar, except it fails to log in also. The json is filled in correctly:

main.(*Client).Login
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/client.go:69
main.main.func1
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:33
2023-07-25T00:52:17.611+0200    ERROR   reddit-placebot-2023-master/client.go:69        Login failed    {"username": "", "username": ""}
main.(*Client).Login
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/client.go:69
main.main.func1
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:33
Login finished!
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0x50a3cf]

goroutine 1 [running]:
main.(*Board).GetDifferentData(0xa04b020)
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/board.go:43 +0x7f
main.(*Worker).Run(0xa025d60)
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/worker.go:37 +0x4e
main.main()
        C:/Users/X/OneDrive/Desktop/reddit-placebot-2023-master/main.go:47 +0x5b8

It was my BMP file. I would try using a different image. When I used a different image and https://products.aspose.app/imaging/image-editor/bmp to scale the BMP down to 32x32, the error went away

Sadly that made no difference, but the website will come in handy, thanks 👍 I think the runtime error may have to do with failing to login, but I have no idea how to fix this. I have used the exact same layout as used in users.json.rename