Solana.Unity-SDK icon indicating copy to clipboard operation
Solana.Unity-SDK copied to clipboard

Runtime error: table index is out of bounds.

Open sukrucildirr opened this issue 6 months ago • 6 comments

Is your feature request related to a problem? Please describe.

After connecting wallet and request to mint, I'm getting " table index is out of bounds " and screen is not responding. image

Describe the solution you'd like

  • Check the size of the table before accessing an index: Before accessing an index in a table, always check that the index is less than the size of the table.
  • Use the ipairs function for iterating over tables: The ipairs function in Lua is specifically designed for iterating over tables. It skips over any nil values and only iterates over the existing indices.
  • Use the pairs function for iterating over tables: The pairs function in Lua iterates over all elements in the table, including nil values. If you're using pairs, make sure to check for nil values.
  • Check the size of the table after modifying it: If you're modifying the table (adding or removing elements) during iteration, make sure to check the size of the table again after each modification.

sukrucildirr avatar Jan 25 '24 15:01 sukrucildirr

@gangstarr60 can you please share the full stack trace and perhaps a video/screenshot on how to reproduce the issue? Would be helpful to know the wallet and browser used.

The described solution you posted seems GPT generated. We are not using Lua.

GabrielePicco avatar Jan 31 '24 09:01 GabrielePicco

I got the explained error and tried with ai. I don't have more information about this language. Wallet : phantom Browser : chrome

sukrucildirr avatar Jan 31 '24 09:01 sukrucildirr

No problems. Thanks for reporting it @gangstarr60 . Can you please copy paste the full stack trace (the error logged in the console) and describe the steps to reproduce the issue?

GabrielePicco avatar Feb 04 '24 16:02 GabrielePicco

My page is not responding after when i click somewhere. Then gives runtime error

[ An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:

RuntimeError: memory access out of bounds

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unity-SDK.wasm:wasm-function[548]:0x7a3f1

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unity-SDK.wasm:wasm-function[15496]:0x8ab693

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unity-SDK.wasm:wasm-function[26517]:0xfeb587

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unity-SDK.wasm:wasm-function[35210]:0x15867ab

at invoke_viiii (https://magicblock-labs.github.io/Solana.Unity- SDK/Build/Solana.Unity-SDK.framework.js:10:382263)

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unity-SDK.wasm:wasm-function[31256]:0x132c075

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unity-SDK.wasm:wasm-function[65776]:0x1d57469

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unitv-SDK.wasm:wasm-functionl449461:0x1733bd1

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unity-SDK.wasm:wasm-function[1256]:0xb349b

at https://magicblock-labs.github.io/Solana.Unity-SDK/Build/ Solana.Unity-SDK.wasm:wasm-function[35214]:0x15867e5

at invoke_viii (https://magicblock-labs.github.io/Solana.Unity- SDK/Build/... ]

sukrucildirr avatar Feb 04 '24 16:02 sukrucildirr

I'm unable to reproduce the issue unfortunately, the hosted demo work correctly on all the setup I tested. Could you please specify OS, browser version and anything you think is relevant to reproduce on my end.

GabrielePicco avatar Feb 07 '24 00:02 GabrielePicco

Windows 10 Home Single Language Chrome 121.0.6167.140 Phantom wallet

sukrucildirr avatar Feb 07 '24 18:02 sukrucildirr