Merge branch 'alejandro-master-patch-53351' into 'master'

Better error handling

See merge request morningstar/apollyon!1
This commit is contained in:
Harmonic 2019-06-11 18:59:25 -04:00
commit 629727be3a

View File

@ -12,6 +12,7 @@ import javax.imageio.ImageIO;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.IllegalArgumentException;
public class CameraRoomPictureEvent extends MessageHandler public class CameraRoomPictureEvent extends MessageHandler
{ {
@ -49,23 +50,17 @@ public class CameraRoomPictureEvent extends MessageHandler
this.client.getHabbo().getHabboInfo().setPhotoTimestamp(timestamp); this.client.getHabbo().getHabboInfo().setPhotoTimestamp(timestamp);
this.client.getHabbo().getHabboInfo().setPhotoRoomId(room.getId()); this.client.getHabbo().getHabboInfo().setPhotoRoomId(room.getId());
this.client.getHabbo().getHabboInfo().setPhotoJSON(json); this.client.getHabbo().getHabboInfo().setPhotoJSON(json);
BufferedImage theImage = null;
try {
theImage = ImageIO.read(new ByteBufInputStream(image));
} catch (IOException e) {
e.printStackTrace();
}
try { try {
BufferedImage theImage = ImageIO.read(new ByteBufInputStream(image));
ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL)); ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL));
} catch (IOException e) {
e.printStackTrace();
}
try {
ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL_small)); ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL_small));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IllegalArgumentException e) {
System.out.println("YOU ARE NOT USING A PATCHED HABBO.SWF. Run HabKit to patch the camera to use PNG encoding.");
} }
this.client.sendResponse(new CameraURLComposer(URL)); this.client.sendResponse(new CameraURLComposer(URL));
} }
} }