Fix a couple npes if the client isnt' loaded

This commit is contained in:
Adam
2017-04-21 22:35:31 -04:00
parent b8b962ec20
commit 345d197171
2 changed files with 16 additions and 8 deletions

View File

@@ -138,7 +138,13 @@ public class MenuManager
{
int index = IDX_LOWER;
String[] playerOptions = RuneLite.getClient().getPlayerOptions();
Client client = RuneLite.getClient();
if (client == null)
{
return IDX_UPPER;
}
String[] playerOptions = client.getPlayerOptions();
while (index < IDX_UPPER && playerOptions[index] != null)
{
index++;

View File

@@ -22,7 +22,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.ui;
import java.applet.Applet;
@@ -40,9 +39,9 @@ import org.slf4j.LoggerFactory;
final class ClientPanel extends JPanel implements ComponentListener
{
private static final Logger logger = LoggerFactory.getLogger(ClientPanel.class);
public static final int PANEL_WIDTH = 765, PANEL_HEIGHT = 503;
private Applet rs;
public ClientPanel() throws Exception
@@ -78,10 +77,13 @@ final class ClientPanel extends JPanel implements ComponentListener
@Override
public void componentResized(ComponentEvent e)
{
rs.setLocation(0, 0);
rs.setSize(this.getSize());
if (rs != null)
{
rs.setLocation(0, 0);
rs.setSize(this.getSize());
rs.setPreferredSize(this.getPreferredSize());
}
this.setPreferredSize(this.getSize());
rs.setPreferredSize(this.getPreferredSize());
}
@Override
@@ -98,4 +100,4 @@ final class ClientPanel extends JPanel implements ComponentListener
public void componentHidden(ComponentEvent e)
{
}
}
}