Maintaining health of Lithium polymer battery
I strongly recommend removing the battery as soon as possible. The fact that is has swollen means highly explosive gases have build-up inside.
&quot;Lithium-ion batteries use a chemical reaction to generate power. As the battery ages, this chemical reaction no longer completes perfectly, which can result in the creation of gas (called outgassing), leading to a swollen battery. Additionally, if the battery’s internal layers do not maintain proper separation (due to damage or defect), outgassing, swelling, and even fire can occur. Swelling is the result of particulates getting caught in between the layers of the battery and eventually puncturing the membrane that separate the layers. If the membrane has been compromised, moisture in the air can react with the cell, causing the cell to swell.&quot; Source
Keeping it at 40% and working directly on the charger reduces the stress on the battery.
The most dangerous time for a battery is when is discharging and when exposed to heat. To keep it simple, discharging faster than it can provide current will cause instability. Heating it up means, in simple terms, increasing thermal agitation of electrons, thus, resulting in instability. By now, your battery's capacity is no longer how it was out of the factory, so it will discharge much faster and charge much faster. But the process is more volatile. More details about this process, here.
So keeping it at 40% is a good idea. Keeping it at around 30 degrees Celsius is also a good idea. Throwing it away is even a better idea.
When storing it for long time, keep it at around 50%.
TL;DR
Having and extinguisher around won't do much if your battery is still hot from any stress it was undergoing at the time of catching fire. Keep your battery cool and away of any discharging/charging stress.