fix (cmd,pkg) : Potential Panic/Crash via Nil Pointer Dereference in Switch Context Command#464
Conversation
|
Welcome to the Microcks community! 💖 Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly. Hope you have a great time there! |
|
@lbroudoux @Harsh4902 |
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
a9d7d7c to
a910fc5
Compare
|
hi @Harsh4902 I have done the required changes , now PR is ready to be reviewed, do whenever you get time |
|
You are now a Microcks community contributor! 💖 Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏 📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact. If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌" Kudos and please keep going, we need you 🙌 |
Description
If a user runs the
contextcommand on a fresh installation without a pre-existing configuration,config.ReadLocalConfig(...)returnsnil, nil. The command checks for errors but not fornilvalues, and proceeds directly to accesslocalCfg.CurrentContext:This causes a runtime nil-pointer dereference panic.
Reason
Standard CLI usability dictates that commands should fail gracefully with a user-friendly message rather than panicking when no configuration is initialized.
Closes #462